2 Replies Latest reply: Jan 20, 2012 1:04 AM by Anton Lisovenko RSS

    java.lang.OutOfMemoryError: PermGen space in Maven

    Anton Lisovenko Newbie

      Hi.

       

      I launch the test with the following options:

      MAVEN_OPTS=-XX:MaxPermSize=550m -Xmx1100m

       

      and in my pom:

       

           

         <plugin>
      
                                              <artifactId>maven-surefire-plugin</artifactId>
                                              <executions>
                                                        <execution>
                                                                  <id>surefire-it</id>
                                                                  <goals>
                                                                            <goal>test</goal>
                                                                  </goals>
                                                                  <configuration>
                                                                            <argLine>-Xms712m -Xmx712m -XX:MaxPermSize=500m</argLine>
                                                                            <skip>false</skip>
                                                                            <printSummary>true</printSummary>
                                                                            <forkMode>always</forkMode>
                                                                            <includes>
                                                                                      <include>**/*IT.java</include>
                                                                            </includes>
                                                                  </configuration>
                                                        </execution>
                                              </executions>
                                    </plugin>
      

       

       

      But I keep on getting the permgen exception...:

       

      19.01.2012 22:17:07 com.sun.enterprise.web.WebContainer createHttpListener

      INFO: WEB0169: Created HTTP listener [http-listener] on host/port [0.0.0.0:7171]

      22:17:07,818  INFO FacesServletInitializer:39 - Auto-registering FacesServlet with mappings: [/faces/*, *.jsf, *.faces]

      19.01.2012 22:17:07 com.sun.enterprise.web.WebContainer createHttpListener

      INFO: WEB0169: Created HTTP listener [http-listener] on host/port [0.0.0.0:7171]

      22:17:07,855  INFO FacesServletInitializer:39 - Auto-registering FacesServlet with mappings: [/faces/*, *.jsf, *.faces]

      19.01.2012 22:17:07 com.sun.enterprise.web.WebContainer createHttpListener

      INFO: WEB0169: Created HTTP listener [http-listener] on host/port [0.0.0.0:7171]

      19.01.2012 22:17:07 org.glassfish.deployment.admin.DeployCommand execute

      INFO: KaskoCalculator was successfully deployed in 19а369 milliseconds.

      PlainTextActionReporterSUCCESSDescription: deploy AdminCommandApplication deployed with name KaskoCalculator.

          [name=KaskoCalculator

      Exception in thread "DynamicReloader" java.lang.OutOfMemoryError: PermGen space

      19.01.2012 22:17:22 com.sun.enterprise.web.VirtualServer$1 log

      WARNING: StandardWrapperValve[ArquillianServletRunner]: PWC1406: Servlet.service() for servlet ArquillianServletRunner threw exception

      java.lang.OutOfMemoryError: PermGen space

       

      When I launch tests in eclipse -XX:MaxPermSize=300m is ALWAYS enough!

       

      What is the correct way to provide permgen options to surefire?

       

      Thanks

        • 1. Re: java.lang.OutOfMemoryError: PermGen space in Maven
          Aslak Knutsen Master

          using argLine is the correct way as far as i know. Not sure why it would require more mem using Maven then Eclipse.

          • 2. Re: java.lang.OutOfMemoryError: PermGen space in Maven
            Anton Lisovenko Newbie

            Nonsense, but this piece of code worked for me..:

             

            <plugin>

                                                    <artifactId>maven-surefire-plugin</artifactId>

                                                    <version>2.11</version>

                                                    <configuration>

                                                              <argLine>-Xms800m -Xmx800m -XX:MaxPermSize=500m</argLine>

                                                              <includes>

                                                                        <include>**/*IT.java</include>

                                                              </includes>

                                                    </configuration>

            </plugin>

             

            As visualVm said - no java properties were passed to forked java process in previous case, seems the "afgLine" configuration MUST be set for the plugin itself, not its special execution...