5 Replies Latest reply on May 13, 2014 11:20 AM by hawe

    Java.lang.OutOfMemoryError: PermGe

    chaluwa

      I am getting a Java.lang.OutOfMemoryError: PermGen from ErraiServlet when I run mvn clean gwt:run and try to do something (post data to the app / server) on the app.

      I also changed my JVM params (via extraJvmArgs) to -Xmx3584m -XX:CompileThreshold=7000 -XX:MaxPermSize=2048M but to no avail. Any hints on solving this. I am running on the latest Errai version (3.0.0.CR1) with JBoss EAP 6.2.0.GA

        • 1. Re: Java.lang.OutOfMemoryError: PermGe
          hawe

          I ran into the same problem.

          I was able to fix the issue by changing my persistence.xml. In my case the problem was because of a persistence.xml scanning my whole persistence subproject. After declaring all Entities inside the persistence.xml with the <class> tag the permgen problem disappeared.

          • 2. Re: Java.lang.OutOfMemoryError: PermGe
            chaluwa

            I made an attempt to add <class>com.bitrunk.apps.uniaccess.client.shared.Institution</class> to the persistence.xml file, but I got some sort of validation (xml) error message. I edited the project properties and turned off auto scanning of entity classes and then the persistence file complained of duplicate class entry for <class>com.bitrunk.apps.uniaccess.client.shared.Institution</class> even though I had just one entry. The Institution class (as well as other entity classes) also had an error complaining that it was not listed in the persistence file. I can't figure out how to manually list the managed classes in the persistence file.

             

            I also want to state that I followed Sadilek's (from IRC) advice and added -Derrai.jboss.javaopts="-XX:MaxPermSize=2048M" to <extraJvmArgs> in the pom file, and this is why the app even ran at all. Before then, the out of memory error presents the app ( the server actually) from starting. The new error log is here : http://ur1.ca/haglr

            • 3. Re: Re: Java.lang.OutOfMemoryError: PermGe
              chaluwa

              The out of memory issue is now fixed but with a little twist. Here is how my pom file is currently setup :

                <properties>
                  .....
                  <eap.javaopts> -Dorg.jboss.as.logging.per-deployment=false -XX:MaxPermSize=3548M</eap.javaopts>
                  <errai.jboss.home>/Applications/jbdevstudio/runtimes/jboss-eap</errai.jboss.home>  
                </properties>
               ...
              
              
              <extraJvmArgs>-Xmx712m -XX:CompileThreshold=7000 -XX:MaxPermSize=512M -Derrai.jboss.home=${errai.jboss.home} ...  -Derrai.jboss.javaopts=${eap.javaopts}</extraJvmArgs>
              

               

              The problem is that it appears only the first value of the <eap.javaopts> property is picked up by the system, but I need to use both (all) of them. Any hints

              • 4. Re: Re: Re: Java.lang.OutOfMemoryError: PermGe
                mbarkley

                Charles,

                 

                I tried this out and your second property isn't being picked up because of the space. You need to wrap the properties in quotes when you pass them via errai.jboss.javaopts, like so:

                -Derrai.jboss.javaopts="${eap.javaopts}"
                

                 

                Cheers.

                • 5. Re: Java.lang.OutOfMemoryError: PermGe
                  hawe

                  If you get the validation error of the peristence.xml by eclipse you can either ignore it or play with the sorting of the <class> and <exclude-unlisted-classes>true</exclude-unlisted-classes> entries (the exclude one should be after the <class> elements I guess.