We have a EAR with 3 EJB modules. I am trying to deploy to glassfish but am hitting an error I can't explain or work out how best to identify.
[#|2010-08-03T14:39:15.570+0100|INFO|glassfish3.0.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=28;_ThreadName=Thread-1;|[AutoDeploy] Selecting file /export/home/myapp/apps/domains/myapp/autodeploy/App-ear.ear for autodeployment.|#]
[#|2010-08-03T14:39:18.654+0100|WARNING|glassfish3.0.1|javax.enterprise.system.tools.deployment.org.glassfish.deployment.common|_ThreadID=28;_ThreadName=Thread-1;|Error in annotation processing: java.lang.NoClassDefFoundError: com/company/app/controller/IMessagingProcessor|#]
[#|2010-08-03T14:39:20.470+0100|SEVERE|glassfish3.0.1|global|_ThreadID=28;_ThreadName=Thread-1;|Class [ Lcom/company/app/jms/IJmsSessionFactory; ] not found. Error while loading [ class com.company.app.eventprocessor.provider.EventProvider ]|#]
I have checked the classes mentioned in the ClassNotFoundException and they are definetly in a Jar in the ear and I have no compilation issues in eclipse/maven.
D:\Repository\App\AppEA\App-ear\target\App-ear.ear\CoreJms-1.0-SNAPSHOT.jar\com\company\app\controller\IMessagingProcessor.class
D:\Repository\App\AppEA\App-ear\target\App-ear.ear\EventProcessor-ejb-1.0-SNAPSHOT.jar\com\company\app\eventprocessor\provider\EventProvider.class
Any pointers are much appreciated.
James
Actually, you're not getting a
ClassNotFoundException
, you're getting aNoClassDefFoundError
and I suspect some dependencies to be missing, as suggested by:Where is that
com.company.app.jms.IJmsSessionFactory
?Where is the
log4j.jar
exactly? In/lib
? Can you actually show the structure of your EAR? And please also show theMANIFEST.MF
of your EJB-JAR.Just in case, here is a relevant quote from Packaging EJB 3 Applications:
Bundling dependencies into an EJB-JAR is not supported (see MEJB-3) mostly because jar-within-jar is not part of the JAR specification (and might not be supported by all EJB container) and does not comply with Sun's advice regarding J2EE packaging in general.
So while you may ignore this rule (see this trick or this one), the standard way would be to package the EJB-JAR and all the JARs it depends on in an EAR. This is my recommendation and I think that this post might help: Because I always forget how to use maven-ear-plugin.