1 2 Previous Next 15 Replies Latest reply on Apr 16, 2013 3:08 PM by Daniel Wehrle

    NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2

    Daniel Wehrle Newbie

      Hi,

       

      i try to migrate our application from AS 7.1.1 to EAP 6.1.0 alpha on Windows.

       

      In deployment I get a NoClassDefFoundError (EAP 6.1.0 alpha and AS 7.2.0). With each deployment an other class is not found. If i move the mc-Package from the ejb.jar to the lib-Dir, classes are found. In this stacktrace class AssetThumbPanel is not annotated as @Entity.

       

      Stacktrace:

       

      15:23:54,042 INFO  [org.hibernate.ejb.Ejb3Configuration] (ServerService Thread Pool -- 60) HHH000204: Processing PersistenceUnitInfo [

          name: mc

          ...]

      15:24:10,136 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 60) MSC00001: Failed to start service jboss.persistenceunit."mc.ear/ejb.jar#mc": org.jboss.msc.service.StartException in service jboss.persistenceunit."mc.ear/ejb.jar#mc": java.lang.NoClassDefFoundError: mc/portal/page/asset/list/AssetThumbPanel

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_15]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_15]

          at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_15]

          at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final]

      Caused by: java.lang.NoClassDefFoundError: mc/portal/page/asset/list/AssetThumbPanel

          at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.7.0_15]

          at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [rt.jar:1.7.0_15]

          at java.lang.ClassLoader.defineClass(ClassLoader.java:634) [rt.jar:1.7.0_15]

          at org.jboss.as.jpa.classloader.TempClassLoader.findClass(TempClassLoader.java:79)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]

          at org.jboss.as.jpa.hibernate4.HibernateAnnotationScanner.getPackagesInJar(HibernateAnnotationScanner.java:171)

          at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:490)

          at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:852)

          at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:591)

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)

          ... 4 more

      Caused by: java.lang.ClassNotFoundException: mc.portal.page.asset.list.AssetThumbPanel

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:450) [jboss-modules.jar:1.2.0.CR1]

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]

          ... 20 more

       

      Deployment structure of ear:

       

      mc.ear

      +-ejb.jar

      |   + mc-Package

      |   + META-INF

      |        + persistence.xml

      + lib

      + META-INF

      |    + application.xml

      |    + jboss-deployment-structure.xml

      + web.war

       

       

      persistence.xml

       

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"

        version="1.0">

       

        <persistence-unit name="mc">

          <jta-data-source>java:/mcDS_core</jta-data-source>

          <jar-file>ejb.jar</jar-file>

          <properties>

            <property name="hibernate.hbm2ddl.auto"                    value="none"/>

            <property name="hibernate.dialect"                         value="mc.core.system.util.db.SQLServerDialect"/>

            <property name="hibernate.show_sql"                        value="false"/>

            <!-- to support legacy @GeneratedValue for @Id -->

            <property name="hibernate.id.new_generator_mappings"        value="false"/>

            <!-- JB7 uses infinispan cache, bound to "java:jboss/infinispan/container/hibernate" in JNDI -->

            <property name="hibernate.cache.use_second_level_cache"    value="true"/>

            <property name="hibernate.cache.use_query_cache"            value="true"/>

       

            <!-- automatically optimize index after n operations or transactions -->

            <property name="hibernate.search.default.optimizer.operation_limit.max"    value="10000"/>

            <property name="hibernate.search.default.optimizer.transaction_limit.max"    value="1000"/>

            <property name="hibernate.search.default.directory_provider"              value="mc.core.system.ftindex.FtiDirectoryProvider"/>

       

            <!-- JB7 does not register EM in JNDI, only EMF -->

            <property name="jboss.entity.manager.jndi.name"           value="java:jboss/EntityManagers/mc"/>

            <property name="jboss.entity.manager.factory.jndi.name"   value="java:jboss/EntityManagerFactories/mc"/>

       

          </properties>

        </persistence-unit>

       

      </persistence>

       

       

      application.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <application>

          <display-name>mc</display-name>

          <module>

              <ejb>ejb.jar</ejb>

          </module>

          <module>

              <web>

                  <web-uri>web.war</web-uri>

                  <context-root>mc</context-root>

              </web>

          </module>

      </application>

       

       

      jboss-deployment-structure.xml:

       

      <jboss-deployment-structure>

          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>

          <deployment>

              <dependencies>

       

                  <!-- mc compile time dependencies -->

                  <module name="org.apache.commons.beanutils" />

                  <module name="org.apache.commons.io" />

                  <module name="org.infinispan" />

                  <module name="org.jboss.logmanager" />

                  <!-- hibernate search runtime dependencies -->

                  <module name="org.codehaus.jackson.jackson-core-asl" />

                  <module name="org.codehaus.jackson.jackson-mapper-asl" />

                  <module name="org.hibernate.commons-annotations" />

                  <!-- jsontools runtime dependencies -->

                  <module name="org.antlr" />

                  <!-- milton (webdav) runtime dependencies -->

                  <module name="org.jdom" />

                  <module name="org.slf4j" />

                  <module name="org.apache.commons.codec" />

                  <!-- poi runtime dependencies -->

                  <module name="org.dom4j" />

                  <!-- tika runtime dependencies -->

                  <module name="asm.asm" />

       

                  <!-- runtime dependencies from various jars -->

                  <!-- check if and why needed

                  <module name="org.apache.log4j" />

                  <module name="org.apache.commons.logging" /> -->

       

              </dependencies>

          </deployment>

       

          <!-- we have to repeat dependencies for sub-deployments. see https://issues.jboss.org/browse/AS7-3955 -->

       

          <sub-deployment name="ejb.jar">   

              <dependencies>     

                  <module name="org.apache.commons.beanutils" />

                  <module name="org.apache.commons.io" />

                  <module name="org.infinispan" />

                  <module name="org.jboss.logmanager" />

                  <module name="org.codehaus.jackson.jackson-core-asl" />

                  <module name="org.codehaus.jackson.jackson-mapper-asl" />

                  <module name="org.hibernate.commons-annotations" />

                  <module name="org.antlr" />

                  <module name="org.jdom" />

                  <module name="org.slf4j" />

                  <module name="org.apache.commons.codec" />

                  <module name="org.dom4j" />

                  <module name="asm.asm" />

              </dependencies>

          </sub-deployment>

          <sub-deployment name="web.war">   

              <dependencies>     

                  <module name="org.apache.commons.beanutils" />

                  <module name="org.apache.commons.io" />

                  <module name="org.infinispan" />

                  <module name="org.jboss.logmanager" />

                  <module name="org.codehaus.jackson.jackson-core-asl" />

                  <module name="org.codehaus.jackson.jackson-mapper-asl" />

                  <module name="org.antlr" />

                  <module name="org.jdom" />

                  <module name="org.slf4j" />

                  <module name="org.apache.commons.codec" />

                  <module name="org.dom4j" />

                  <module name="asm.asm" />

              </dependencies>

          </sub-deployment>

      </jboss-deployment-structure>

        • 1. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
          Daniel Wehrle Newbie

          I found https://docs.jboss.org/author/display/AS72/JPA+Reference+Guide#JPAReferenceGuide-Deployment

           

          "NOTE: Java Persistence 1.0 supported use of a jar file in the root of the EAR as the root of a persistence unit. This use is no longer supported. Portable applications should use the EAR library directory for this case instead."

           

          May be this is our problem?

          • 2. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
            Wolf-Dieter Fink Master

            Where is the missing class mc.portal.page.asset.list.AssetThumbPanel packed?

            • 4. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
              Scott Marlow Master

              Could you enable TRACE logging for org.jboss.as.jpa?  I'd like to see the AS/standalone/log/server.log contents during the deployment of mc.ear (with TRACE LOGGING enabled).

              • 6. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                Scott Marlow Master

                Could you also attach the output of "jar tf ejb.jar" (you might need to "jar xf mc.ear" the contents of the ear if needed to get to it). 

                 

                I could see other entity classes are discovered in the mc.ear/ejb.jar:

                14:49:08,221 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar url=/Z:/mc7.1/core/jboss/jboss-as-7.2.0.Final/standalone/deployments/mc.ear/ejb.jar/ annotations=[interface javax.persistence.Embeddable, interface javax.persistence.MappedSuperclass, interface javax.persistence.Entity]

                14:49:08,221 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.EntityBitField with annotation javax.persistence.Embeddable

                14:49:08,221 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.EntityBase with annotation javax.persistence.MappedSuperclass

                14:49:08,236 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.EntityData with annotation javax.persistence.MappedSuperclass

                14:49:08,236 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.EntityFilter with annotation javax.persistence.MappedSuperclass

                14:49:08,236 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.EntityText with annotation javax.persistence.MappedSuperclass

                14:49:08,236 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.SimpleEntity with annotation javax.persistence.MappedSuperclass

                14:49:08,236 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.base.TypeEntity with annotation javax.persistence.MappedSuperclass

                14:49:08,252 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.channel.ChannelMapBase with annotation javax.persistence.MappedSuperclass

                14:49:08,252 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.channel.ImportMap with annotation javax.persistence.MappedSuperclass

                14:49:08,252 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.channel.ProfileBase with annotation javax.persistence.MappedSuperclass

                14:49:08,252 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.channel.ProfileTypeBase with annotation javax.persistence.MappedSuperclass

                14:49:08,268 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.project.ProjectPrincipalBase with annotation javax.persistence.MappedSuperclass

                14:49:08,268 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.view.model.ViewBaseEntity with annotation javax.persistence.MappedSuperclass

                14:49:08,268 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.Asset with annotation javax.persistence.Entity

                14:49:08,283 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetArchivingTask with annotation javax.persistence.Entity

                14:49:08,299 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetBasketItem with annotation javax.persistence.Entity

                14:49:08,299 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetDerivate with annotation javax.persistence.Entity

                14:49:08,299 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetDerivateType with annotation javax.persistence.Entity

                14:49:08,314 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetHotfolder with annotation javax.persistence.Entity

                14:49:08,314 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetPipeline with annotation javax.persistence.Entity

                14:49:08,314 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetType with annotation javax.persistence.Entity

                14:49:08,314 TRACE [org.jboss.as.jpa] (ServerService Thread Pool -- 59) getClassesInJar found class mc.core.model.asset.AssetUsage with annotation javax.persistence.Entity

                .

                .

                .  remaining output skipped

                .

                .

                .

                • 7. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                  Daniel Wehrle Newbie

                  Here the result of "jar tf ejb.jar".

                   

                  The classes which are not discovered are not entities

                   

                  package mc.portal.page.asset.list;
                  
                  import java.util.List;
                  
                  import mc.core.model.asset.Asset;
                  
                  import org.apache.wicket.markup.html.form.CheckGroup;
                  import org.apache.wicket.model.IModel;
                  
                  
                  public class AssetThumbPanel extends AssetListBasePanel
                  {
                      private static final long    serialVersionUID    = -2717459278974808778L;
                      public static final int        DEFAULT_PAGE_SIZE    = 20;
                  
                      public AssetThumbPanel(String id)
                      {
                          super( id);
                      }
                  
                      public AssetThumbPanel(String id, IModel<List<Asset>> assetListModel, CheckGroup<Asset> checkGroup)
                      {
                          super( id, assetListModel, checkGroup);
                          addModal( "");
                          setPageSize( DEFAULT_PAGE_SIZE);
                      }
                  }
                  
                  • 8. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                    Daniel Wehrle Newbie

                    Hi Scott,

                     

                    have you found any problems? Perhaps there is a workaround?

                    • 9. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                      Nicklas Karlsson Master

                      No persistence related jar:s bundled in the EAR? No references from other entities to this class?

                      • 10. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                        Daniel Wehrle Newbie

                        Content of lib-Dir:

                         

                        avro-1.5.1.jar

                        axis.jar

                        bootstrapconnector.jar

                        commons-compress-1.4.1.jar

                        commons-discovery-0.4.jar

                        commons-fileupload-1.2.1.jar

                        commons-httpclient-3.0.1.jar

                        commons-net-3.0.1.jar

                        core-renderer.jar

                        fontbox-1.7.1.jar

                        hibernate-search-engine-4.1.1.Final.jar

                        hibernate-search-orm-4.1.1.Final.jar

                        ib-ws-api.jar

                        idsp-wsdl-java.jar

                        iText-2.1.7.jar

                        jempbox-1.7.1.jar

                        jsontools-core-1.7.jar

                        junitee.jar

                        junit_3.8.1.jar

                        lucene-analyzers-3.5.0.jar

                        lucene-core-3.5.0.jar

                        lucene-highlighter-3.5.0.jar

                        metadata-extractor-2.6.2.jar

                        milton-api-1.6.8.jar

                        milton-servlet-1.6.8.jar

                        mime-util-2.1.3.jar

                        open-office-3.4.0.jar

                        pdfbox-1.7.1.jar

                        poi-3.9-20121203.jar

                        poi-ooxml-3.9-20121203.jar

                        poi-ooxml-schemas-3.9-20121203.jar

                        poi-scratchpad-3.9-20121203.jar

                        sqlite4java.jar

                        tagsoup-1.2.1.jar

                        tika-core-1.3.jar

                        tika-parsers-1.3.jar

                        velocity-dep-1.5.jar

                        wicket-core-6.5.0.jar

                        wicket-extensions-6.5.0.jar

                        wicket-request-6.5.0.jar

                        wicket-util-6.5.0.jar

                        wiquery-core-6.2.0.jar

                        wiquery-jquery-ui-6.2.0.jar

                        wsdl4j-1.5.1.jar

                        xmlbeans-2.3.0.jar

                        xz-1.0.jar

                        • 11. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                          Scott Marlow Master

                          Seems like mc.portal.page.asset.list.AssetThumbPanel depends on another class that is not found (since mc.portal.page.asset.list.AssetThumbPanel is obviously in the ejb jar).

                           

                          I'm not sure if its easier to enable classloading tracing and reading the output (very verbose) or hacking the AssetThumbPanel class to comment out dependencies (and code as needed). 

                           

                          Whether your hitting a bug or not, I'm not sure of yet.  The org.jboss.as.jpa.classloader.TempClassLoader is a temporary classloader that is only used during JPA deployments (avoids using the app classloader so that app classes can still be enhanced).  I don't suspect a classloadering bug in org.jboss.as.jpa.classloader.TempClassLoader but that might be something to look at also.

                          • 12. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                            Daniel Wehrle Newbie

                            Hi Scott,

                             

                            i can say that all classes from which AssetThumbPanel depends are in the jar. Same ear deploys in 7.1.1. And with each deployment in 7.2.0 it's an other class which is not found by the TempClassLoader.

                             

                            Attached the log with -verbose:class. At line 31261 the error occurs. This time with class mc/portal/wicket/widget/Widget (last loaded at line 30723)

                            • 13. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                              Scott Marlow Master

                              Hi Daniel,

                               

                              I'm not sure of what the problem is yet (looked at the above standalone.zip). 

                               

                              Could you try deploying against the latest community nightly build from this link?  If that also doesn't work, we might be able to make a simple change for you to try. 

                               

                              Scott

                              • 14. Re: NoClassDefFoundError with PersistenceUnit in EAP 6.1.0 alpha and AS 7.2
                                Scott Marlow Master

                                Daniel,

                                 

                                I created AS7-6925 for this issue, when that is fixed, could you try again using the above nightly build link?  You should be able to watch the AS7-6925 jira so you know when its fixed.

                                 

                                Scott

                                1 2 Previous Next