0 Replies Latest reply on Mar 11, 2013 6:19 AM by jchrist7

    JBoss PermGen errors

    jchrist7 Newbie

      I created a JSF application using Primefaces and Seam-Rest module along a REST backend and I am experiencing continuous perm gen errors in JBoss AS 7.1 (using 7.1.3 Final built from tag).

      In order to narrow down where my problem lies, I created a simple Maven project from a blank archetype, using jboss's java ee apis, as well as including seam-rest and primefaces and I still seem to get these Perm Gen errors.

      After testing this, it seems that if I include either seam-rest or primefaces (or both) in my project, the permgen errors will occur. If I leave them both out (that is producing an almost empty war), only then do I get rid of the perm gen errors.

      In order to test my simple project for classloading leaks, I created a file containing deploy test.war / undeploy test.war commands and I pass it to jboss-cli.sh.

      If that might be of any help, I'm including my pom.xml

       

      I really need to sort these permgen errors out and from what I can see, it is not an issue of my application.

       

      UPDATE:

      Building JBoss 7.2.0.Final from tag seems to fix these permgen errors for the simple web application when I include Primefaces(strange but JBoss 8 Alpha1 does not), but the problem is still there when I try to include the seam-rest module.

      Maybe it has something to do with the warning about the private module used (httpcomponents)?

       

      Does anyone have any experience on these issues?

       

      ps. Also, I am trying to fully understand JBoss's classloading system. I've found a lot in the documentation (unfortunately JBoss Modules could be more documented), but I cannot find why JBoss does not perform lazy classloading, similar to Tomcat's. Or, if that is not the case and I'm terribly wrong, why do I see perm gen size increase after each deployment.

       

       

      EDIT: After a lot of confusion and testing, I found out that the problem was seam 3's rest module. I tried to test it using JBoss AS 7.2.0.Final and Seam Rest 3.5.0-SNAPSHOT, but did not manage to solve the PermGen errors.

      Unfortunately, the only solution left was to leave out seam-rest module and use only Resteasy's client. That way, I managed to have a working project with no PermGen issues.

       

       

      Thank you very much!

       

      <?xml version="1.0" encoding="UTF-8"?>
      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
                <modelVersion>4.0.0</modelVersion>
      
                <groupId>test.test</groupId>
                <artifactId>test-maven</artifactId>
                <version>0.0.1-SNAPSHOT</version>
                <packaging>war</packaging>
                <name>Java EE 6 webapp project</name>
                <description>A starter Java EE 6 webapp project for use on JBoss AS 7.1 / EAP 6, generated from the jboss-javaee6-webapp archetype</description>
      
      
                <properties>
                          <!-- Explicitly declaring the source encoding eliminates the following 
                                    message: -->
                          <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered 
                                    resources, i.e. build is platform dependent! -->
                          <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      
      
                          <!-- JBoss dependency versions -->
                          <jboss.as.plugin.version>7.3.Final</jboss.as.plugin.version>
      
      
                          <!-- Define the version of JBoss' Java EE 6 APIs and Tools we want to import. -->
                          <jboss.bom.version>1.0.4.Final</jboss.bom.version>
                          <!-- Alternatively, comment out the above line, and un-comment the line 
                                    below to use version 1.0.4.Final which is a release certified to work with 
                                    JBoss EAP 6. It requires you have access to the JBoss EAP 6 maven repository. -->
                          <!-- <jboss.bom.version>1.0.4.Final</jboss.bom.version>> -->
                          <!-- other plugin versions -->
                          <compiler.plugin.version>2.3.2</compiler.plugin.version>
                          <surefire.plugin.version>2.4.3</surefire.plugin.version>
                          <war.plugin.version>2.1.1</war.plugin.version>
      
      
                          <jboss.spec.version>3.0.2.Final</jboss.spec.version>
      
                          <resteasy.version>2.3.5.Final</resteasy.version>
      
                          <primefaces.version>3.5</primefaces.version>
      
                          <seam.version>3.1.0.Final</seam.version>
      
      
                          <!-- maven-compiler-plugin -->
                          <maven.compiler.target>1.7</maven.compiler.target>
                          <maven.compiler.source>1.7</maven.compiler.source>
                </properties>
      
      
                <dependencyManagement>
                          <dependencies>
                                    <!-- JBoss distributes a complete set of Java EE 6 APIs including a Bill 
                                              of Materials (BOM). A BOM specifies the versions of a "stack" (or a collection) 
                                              of artifacts. We use this here so that we always get the correct versions 
                                              of artifacts. Here we use the jboss-javaee-6.0-with-tools stack (you can 
                                              read this as the JBoss stack of the Java EE 6 APIs, with some extras tools 
                                              for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate 
                                              stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras 
                                              from the Hibernate family of projects) -->
                                    <dependency>
                                              <groupId>org.jboss.bom</groupId>
                                              <artifactId>jboss-javaee-6.0-with-tools</artifactId>
                                              <version>${jboss.bom.version}</version>
                                              <type>pom</type>
                                              <scope>import</scope>
                                    </dependency>
                                    <dependency>
                                              <groupId>org.jboss.bom</groupId>
                                              <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
                                              <version>${jboss.bom.version}</version>
                                              <type>pom</type>
                                              <scope>import</scope>
                                    </dependency>
                          </dependencies>
                </dependencyManagement>
      
      
                <dependencies>
                          <dependency>
                                    <groupId>org.jboss.spec</groupId>
                                    <artifactId>jboss-javaee-all-6.0</artifactId>
                                    <version>${jboss.spec.version}</version>
                                    <scope>provided</scope>
                          </dependency>
                          <!-- First declare the APIs we depend on and need for compilation. All 
                                    of them are provided by JBoss AS 7 -->
      
      
                          <!-- Import the CDI API, we use provided scope as the API is included in 
                                    JBoss AS 7 -->
                          <dependency>
                                    <groupId>javax.enterprise</groupId>
                                    <artifactId>cdi-api</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Import the Common Annotations API (JSR-250), we use provided scope 
                                    as the API is included in JBoss AS 7 -->
                          <dependency>
                                    <groupId>org.jboss.spec.javax.annotation</groupId>
                                    <artifactId>jboss-annotations-api_1.1_spec</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Import the JAX-RS API, we use provided scope as the API is included 
                                    in JBoss AS 7 -->
                          <dependency>
                                    <groupId>org.jboss.spec.javax.ws.rs</groupId>
                                    <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Import the JPA API, we use provided scope as the API is included in 
                                    JBoss AS 7 -->
                          <dependency>
                                    <groupId>org.hibernate.javax.persistence</groupId>
                                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Import the EJB API, we use provided scope as the API is included in 
                                    JBoss AS 7 -->
                          <dependency>
                                    <groupId>org.jboss.spec.javax.ejb</groupId>
                                    <artifactId>jboss-ejb-api_3.1_spec</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- JSR-303 (Bean Validation) Implementation -->
                          <!-- Provides portable constraints such as @Email -->
                          <!-- Hibernate Validator is shipped in JBoss AS 7 -->
                          <dependency>
                                    <groupId>org.hibernate</groupId>
                                    <artifactId>hibernate-validator</artifactId>
                                    <scope>provided</scope>
                                    <exclusions>
                                              <exclusion>
                                                        <groupId>org.slf4j</groupId>
                                                        <artifactId>slf4j-api</artifactId>
                                              </exclusion>
                                    </exclusions>
                          </dependency>
      
      
                          <!-- Import the JSF API, we use provided scope as the API is included in 
                                    JBoss AS 7 -->
                          <dependency>
                                    <groupId>org.jboss.spec.javax.faces</groupId>
                                    <artifactId>jboss-jsf-api_2.1_spec</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Now we declare any tools needed -->
      
      
                          <!-- Annotation processor to generate the JPA 2.0 metamodel classes for 
                                    typesafe criteria queries -->
                          <dependency>
                                    <groupId>org.hibernate</groupId>
                                    <artifactId>hibernate-jpamodelgen</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Annotation processor that raising compilation errors whenever constraint 
                                    annotations are incorrectly used. -->
                          <dependency>
                                    <groupId>org.hibernate</groupId>
                                    <artifactId>hibernate-validator-annotation-processor</artifactId>
                                    <scope>provided</scope>
                          </dependency>
      
      
                          <!-- Importing RestEasy JAX-RS: for finding ClientResponse class, etc -->
                          <dependency>
                                    <groupId>org.jboss.resteasy</groupId>
                                    <artifactId>resteasy-jaxrs</artifactId>
                                    <version>${resteasy.version}</version>
                                    <scope>provided</scope>
                          </dependency>
      
      
                             <dependency>
                                    <groupId>org.jboss.seam.rest</groupId>
                                    <artifactId>seam-rest</artifactId>
                                    <version>${seam.version}</version>
                          </dependency>
      
      
                          <!-- Importing primefaces -->
                          <dependency>
                                    <groupId>org.primefaces</groupId>
                                    <artifactId>primefaces</artifactId>
                                    <version>${primefaces.version}</version>
                          </dependency>
      
      
                          <!-- Needed for running tests (you may also use TestNG) -->
                          <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> 
                                    <scope>test</scope> </dependency> Optional, but highly recommended Arquillian 
                                    allows you to test enterprise code such as EJBs and Transactional(JTA) JPA 
                                    from JUnit/TestNG <dependency> <groupId>org.jboss.arquillian.junit</groupId> 
                                    <artifactId>arquillian-junit-container</artifactId> <scope>test</scope> </dependency> 
                                    <dependency> <groupId>org.jboss.arquillian.protocol</groupId> <artifactId>arquillian-protocol-servlet</artifactId> 
                                    <scope>test</scope> </dependency> -->
      
      
                </dependencies>
      
      
                <build>
                          <!-- Maven will append the version to the finalName (which is the name 
                                    given to the generated war, and hence the context root) -->
                          <finalName>${project.artifactId}</finalName>
                          <plugins>
                                    <!-- Compiler plugin enforces Java 1.6 compatibility and activates annotation 
                                              processors -->
                                    <plugin>
                                              <artifactId>maven-compiler-plugin</artifactId>
                                              <version>${compiler.plugin.version}</version>
                                              <configuration>
                                                        <source>${maven.compiler.source}</source>
                                                        <target>${maven.compiler.target}</target>
                                              </configuration>
                                    </plugin>
                                    <plugin>
                                              <artifactId>maven-war-plugin</artifactId>
                                              <version>${war.plugin.version}</version>
                                              <configuration>
                                                        <!-- Java EE 6 doesn't require web.xml, Maven needs to catch up! -->
                                                        <failOnMissingWebXml>false</failOnMissingWebXml>
                                                        <archive>
                                                                  <manifestEntries>
                                                                            <Dependencies>org.apache.httpcomponents</Dependencies>
                                                                  </manifestEntries>
                                                        </archive>
                                              </configuration>
                                    </plugin>
                                    <!-- The JBoss AS plugin deploys your war to a local JBoss AS container -->
                                    <!-- To use, run: mvn package jboss-as:deploy -->
                                    <plugin>
                                              <groupId>org.jboss.as.plugins</groupId>
                                              <artifactId>jboss-as-maven-plugin</artifactId>
                                              <version>${jboss.as.plugin.version}</version>
                                    </plugin>
                          </plugins>
                </build>
      
      
                <profiles>
                          <profile>
                                    <!-- The default profile skips all tests, though you can tune it to run 
                                              just unit tests based on a custom pattern -->
                                    <!-- Seperate profiles are provided for running all tests, including Arquillian 
                                              tests that execute in the specified container -->
                                    <id>default</id>
                                    <activation>
                                              <activeByDefault>true</activeByDefault>
                                    </activation>
                                    <build>
                                              <plugins>
                                                        <plugin>
                                                                  <artifactId>maven-surefire-plugin</artifactId>
                                                                  <version>${surefire.plugin.version}</version>
                                                                  <configuration>
                                                                            <skip>true</skip>
                                                                  </configuration>
                                                        </plugin>
                                              </plugins>
                                    </build>
                          </profile>
      
                          <profile>
                                    <id>primefaces-profile</id>
                                    <activation>
                                              <activeByDefault>true</activeByDefault>
                                    </activation>
                                    <repositories>
                                              <repository>
                                                        <id>prime-repo</id>
                                                        <name>PrimeFaces Maven Repository</name>
                                                        <url>http://repository.primefaces.org</url>
                                                        <layout>default</layout>
                                              </repository>
                                    </repositories>
                          </profile>
      
      
                          <profile>
                                    <!-- When built in OpenShift the 'openshift' profile will be used when 
                                              invoking mvn. -->
                                    <!-- Use this profile for any OpenShift specific customization your app 
                                              will need. -->
                                    <!-- By default that is to put the resulting archive into the 'deployments' 
                                              folder. -->
                                    <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
                                    <id>openshift</id>
                                    <build>
                                              <plugins>
                                                        <plugin>
                                                                  <artifactId>maven-war-plugin</artifactId>
                                                                  <version>${war.plugin.version}</version>
                                                                  <configuration>
                                                                            <outputDirectory>deployments</outputDirectory>
                                                                            <warName>ROOT</warName>
                                                                  </configuration>
                                                        </plugin>
                                              </plugins>
                                    </build>
                          </profile>
      
      
                </profiles>
      </project>