-
1. Re: Classloading of EJB-Modules in AS7
swd847 Jul 7, 2011 9:45 PM (in response to mvecera)Can you post the full stack trace, and details of exactly how the classes are packaged?
-
2. Re: Classloading of EJB-Modules in AS7
mvecera Jul 8, 2011 4:26 AM (in response to swd847)Hello,
attached is an ear and sources to reproduce the issue. Simply start standalone and place ear.ear in deployments directory. I even tried jboss-deployment-structure.xml to explicitely turn off isolated deployments but it did not help. Setting module dependencies in the same file does not help either. It seems like a JIRA candidate...
Here is the stack trace:
10:20:04,343 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."ear.ear".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."ear.ear".INSTALL: Failed to process phase INSTALL of deployment "ear.ear" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:121) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765) at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_25] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_25] at java.lang.Thread.run(Thread.java:662) [:1.6.0_25] Caused by: java.lang.RuntimeException: Error getting reflective information for class class org.jboss.test.engine.TaskHelper at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:142) at org.jboss.as.ee.component.EEClassConfigurationProcessor.processClasses(EEClassConfigurationProcessor.java:124) at org.jboss.as.ee.component.EEClassConfigurationProcessor.deploy(EEClassConfigurationProcessor.java:73) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) ... 5 more Caused by: java.lang.NoClassDefFoundError: org/jboss/test/domain/Company at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_25] at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_25] at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_25] at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.(ClassReflectionIndex.java:65) at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) ... 9 more Caused by: java.lang.ClassNotFoundException: org.jboss.test.domain.Company from [Module "deployment.ear.ear.engine.jar:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358) at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330) at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307) at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101) ... 14 more
-
ear.ear 246.2 KB
-
ear-test.tar.bz2 3.2 KB
-
-
3. Re: Classloading of EJB-Modules in AS7
prasad.deshpande Jul 8, 2011 6:05 AM (in response to mvecera)You can move your domain.jar in lib of your ear, remove reference of domain.jar from application.xml & deploy it. It will work.
packaging like :
ear.ear
+ ---- lib
| |------- commons-lang-2.4.jar
| |------- domain.jar
|
+----- META-INF
| +-- application.xml (jboss-deployment-structure.xml & other files)
|
+ ---- engine.jar
will work.
-
4. Re: Classloading of EJB-Modules in AS7
mvecera Jul 9, 2011 6:50 PM (in response to prasad.deshpande)Thanks for your tip, this really helped. However, isn't it sort of workaround? Shouldn't it work in the original form as well?
-
5. Re: Classloading of EJB-Modules in AS7
prasad.deshpande Jul 8, 2011 5:58 PM (in response to mvecera)Packaging I mentioned above is a standard according to Java EE5 specification, it's not a workaround, and according to it, helper classes should go in lib directory of application. From EJB3 onwards, your entities are pojo classes, not entity beans as such it was in EJB2.x & should go in lib directory. You should not add them as ejb module in application.xml. While deploying in AS7, you can have jar deployed alongside your engine.jar but then you'll need to add Dependencies in the manifest of engine.jar as a dependent module. Better way is to just put them in lib directory as classes in lib directory will be automatically available to engine.jar.