1 Reply Latest reply: Apr 26, 2012 12:16 AM by Julian Klappenbach RSS

Classloader issues with jgroups on AS7.1.1.Final

Julian Klappenbach Newbie

I'm attempting to deploy an ear containing an ejb3 jar to the application server.  I'm getting the following exception stack:

 

12:05:04,642 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class com.mypackage.tr.session.MyClass in Module "deployment.tr.ear.tr.ejb-3.0.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/mypackage/tr/session/MyClass (Module "deployment.tr.ear.tr.ejb-3.0.jar:main" from Service Module Loader)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

          at org.jboss.modules.Module.loadModuleClass(Module.java:517)

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

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

          at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:489) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:851) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:596) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:72) [hibernate-entitymanager-4.0.1.Final.jar:4.0.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]

          at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

Caused by: java.lang.NoClassDefFoundError: org/jgroups/ReceiverAdapter

          at java.lang.ClassLoader.defineClass1(Native Method) [classes.jar:1.6.0_31]

          at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [classes.jar:1.6.0_31]

          at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [classes.jar:1.6.0_31]

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [classes.jar:1.6.0_31]

          at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

          ... 20 more

Caused by: java.lang.ClassNotFoundException: org.jgroups.ReceiverAdapter from [Module "deployment.tr.ear.tr.ejb-3.0.jar:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

          ... 26 more

 

 

12:05:04,677 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."tr.ear/tr.ejb-3.0.jar#tr-pu": org.jboss.msc.service.StartException in service jboss.persistenceunit."tr.ear/tr.ejb-3.0.jar#tr-pu": Failed to start service

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]

          at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

Caused by: java.lang.RuntimeException: error trying to scan <jar-file>: vfs:/content/tr.ear/tr.ejb-3.0.jar/

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

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

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

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

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          ... 3 more

Caused by: java.lang.RuntimeException: JBAS011431: Could not load entity class 'com.mypackage.tr.session.MyClass' with PersistenceUnitInfo.getClassLoader()

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

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

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

          ... 9 more

Caused by: java.lang.ClassNotFoundException: com.mypackage.tr.session.MyClass from [Module "deployment.tr.ear.tr.ejb-3.0.jar:main" from Service Module Loader]

          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

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

          ... 11 more

 

 

I am using standalone-full.xml for the standalone configuration.  I have enabled jgroups as an extension through:

 

<server xmlns="urn:jboss:domain:1.2">

    <extensions>

        <extension module="org.jboss.as.clustering.infinispan"/>

        <extension module="org.jboss.as.clustering.jgroups"/>

 

I've verified that the module for jgroups includes org.jgroups in its dependencies, and that the jar file referenced by this dependency contains the class files for org.jgroups.ReceiverAdapter.  The ear deployment worked just fine in JBAS5, so I'm hoping that this is either a quick configuration change to update the classpath for the application server.  I have tried to add classpath statements to the manifest of both the ejb that references the class, as well as the containing ear, but this hasn't appeared to change things.

 

Thanks in advance.

  • 1. Re: Classloader issues with jgroups on AS7.1.1.Final
    Julian Klappenbach Newbie

    Not sure if this is the proper forum for the issue, but it involves jgroups.  In order to solve my problem, I had to package the jgroups jar in the ear, and set <library-directory> to point to the proper path in the ear.  That way, all child deployables had the jar in their classpath.  But that shouldn't have been necessary.  I'm wrestling with another issue at present, how to get an xa datasource set up for PostgreSQL, but once I have that, I'll put some time into a small project that I can post here to repro the issue.