-
1. Re: Migrating ant + JBoss AS 5 project to JBoss AS 7
kabirkhan Aug 11, 2011 4:31 PM (in response to redmond007)You're right that what we do is based on maven. Your quickest fix is probably to make your build.classpath point to a fileset including all jars under jbossas7/modules
-
2. Re: Migrating ant + JBoss AS 5 project to JBoss AS 7
redmond007 Aug 11, 2011 6:21 PM (in response to kabirkhan)Thank you - your advice enabled me to be able to build my project successfully in as7. I have another problem when I attempt to deploy my application.
I deploy my application by creating a myproject.ear.dodeploy file inside the directory where my ear resides. I then start up as7, which attempts to deploy my project. I get these errors in the jboss logs
16:37:28,473 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC00001: Failed to start service jboss.deployment.unit."myproject.ear".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."myproject.ear".INSTALL: Failed to process phase INSTALL of deployment "myproject.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_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26] at java.lang.Thread.run(Thread.java:680) [:1.6.0_26] Caused by: java.lang.RuntimeException: Error getting reflective information for class com.mycompany.myproject.common.jms.JMSListenerServlet at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) at org.jboss.as.ee.component.EEModuleClassDescription$DefaultConfigurator.configure(EEModuleClassDescription.java:144) at org.jboss.as.ee.component.EEClassConfigurationProcessor.processClasses(EEClassConfigurationProcessor.java:133) at org.jboss.as.ee.component.EEClassConfigurationProcessor.deploy(EEClassConfigurationProcessor.java:76) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:115) ... 5 more Caused by: java.lang.NoClassDefFoundError: com/mycompany/myproject/common/businessobjects/Expert at java.lang.Class.getDeclameMethods0(Native Method) [:1.6.0_26] at java.lang.Class.privateGetDeclameMethods(Class.java:2427) [:1.6.0_26] at java.lang.Class.getDeclameMethods(Class.java:1791) [:1.6.0_26] at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:66) ... 9 more Caused by: java.lang.ClassNotFoundException: com.mycompany.myproject.common.businessobjects.Expert from [Module "deployment.myproject.ear.myproject.war: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 16:37:28,682 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "myproject.ear" was rolled back with failure message {"Failed services" => {"jboss.deployment.unit.\"myproject.ear\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myproject.ear\".INSTALL: Failed to process phase INSTALL of deployment \"myproject.ear\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.myproject.myproject.myproject.ValidatorFactory missing [ jboss.naming.context.java.module.myproject.myproject ]","jboss.naming.context.java.comp.myproject.myproject.myproject.Validator missing [ jboss.naming.context.java.module.myproject.myproject ]"]} 16:37:28,706 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) Stopped deployment myproject.war in 24ms 16:37:28,707 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Stopped deployment myproject.ear in 25ms 16:37:28,709 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Failed services" => {"jboss.deployment.unit.\"myproject.ear\".INSTALL" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"myproject.ear\".INSTALL: Failed to process phase INSTALL of deployment \"myproject.ear\""},"Services with missing/unavailable dependencies" => ["jboss.naming.context.java.comp.myproject.myproject.myproject.ValidatorFactory missing [ jboss.naming.context.java.module.myproject.myproject ]","jboss.naming.context.java.comp.myproject.myproject.myproject.Validator missing [ jboss.naming.context.java.module.myproject.myproject ]"]}}}
The AS7 documentation says the way to resolve NoClassDefFoundError is to find the module name containing the missing class and add it as a dependency in <location of ear>/meta-inf/MANIFEST.MF - but in this case, the class that is missing is a business object class that was created by me - that gets added to my build directory when my project is built, then gets packaged as part of the *har in my *ear. So I add a MANIFEST.MF
Manifest-Version: 1.0 Class-Path: /path/to/myproject.ear/myproject.har
I was uncertain of this approach, but it seemed to be what the documentation was suggesting to do.
When I attempt to deploy my application again I get the error
17:09:27,472 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"myproject.ear\".CONFIGURE_MODULE missing [ jboss.module.information.service.\"deployment.external./path/to/myproject.ear/myproject.har\".main ]"]}}}
I put an absolute path to the *har file containing the missing class - as I wasn't sure from which directory the deploy would be looking for dependencies, so I thought an absolute path would work.
Any advice on how to get past this error? Thank you again!
-
3. Re: Migrating ant + JBoss AS 5 project to JBoss AS 7
sgilda Aug 12, 2011 10:24 AM (in response to redmond007)I am sorry, but the information in the Migration Guide was misleading when it comes to debugging ClassNotFoundExceptions for business classes located within the application. I have modified the document to include this type of error. Check out https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7. It explains in more detail how to package WARs and EARs in AS7 to avoid class loading errors.
-
4. Re: Migrating ant + JBoss AS 5 project to JBoss AS 7
redmond007 Aug 12, 2011 11:55 AM (in response to sgilda)The application I'm attempting to migrate from AS5 to AS7 is structured much like the 'getting started' example for AS4 described here http://docs.jboss.org/jbossas/getting_started/v4/html/hibernate.html. This application packages our hibernate objects as a HAR, we access them from a web application in a WAR file - and the entire application is bundled in an EAR.
myapp.ear
|
|---myapp.har
|
|---myapp.war
The EAR Class Loading section of https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7 states that the ear-subdeployments-isolated setting in the ee subsystem configuration:
</subsystem> <subsystem xmlns="urn:jboss:domain:ee:1.0" > <ear-subdeployments-isolated>false</ear-subdeployments-isolated> </subsystem> <subsystem xmlns="urn:jboss:domain:ejb3:1.0"/> <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate">
set to 'false' would allow classes in my WAR to access classes in my HAR and vice-versa. I'm running in standalone mode and my standalone.xml lacked an ear-subdeployments-isolated element in the ee subsystems config. I added it, restarted my server, but I'm still receiving the NoClassDefFound error I pasted above, indicating that either this setting did not take effect or I'm misinterpreting the cause of the error message.
My application is deployed with an external deployment-scanner, I'm not sure if that could be part of my problem, I thought I should mention it.
I'm looking into restructuring my EAR so that all classes are visible to all subdeployments - I just thought the ear-subdeployments-isolated setting could fix this problem quickly.
-
5. Re: Migrating ant + JBoss AS 5 project to JBoss AS 7
redmond007 Aug 12, 2011 12:31 PM (in response to redmond007)I tried adding an <EAR directory>/meta-inf/MANIFEST.MF file
Manifest-Version: 1.0 Class-Path: /path/to/myapp.ear/myapp.har Dependencies: com.mycompany
which produces a different error
11:23:00,896 INFO [org.jboss.as.server.controller] (DeploymentScanner-threads - 2) Deployment of "myapp.ear" was rolled back with failure message {"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"myapp.ear\".CONFIGURE_MODULE missing [ jboss.module.information.service.\"deployment.external./path/to/myapp.ear/myapp.har\".main ]"]} 11:23:00,896 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) Service status report New missing/unsatisfied dependencies: service jboss.module.information.service."deployment.external./path/to/myapp.ear/myapp.har".main (missing) 11:23:00,897 ERROR [org.jboss.as.deployment] (DeploymentScanner-threads - 1) {"Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"myapp.ear\".CONFIGURE_MODULE missing [ jboss.module.information.service.\"deployment.external./path/to/myapp.ear/myapp.har\".main ]"]}}}
it looks like it's not able to find my HAR - this may be related to the fact that I'm using an external deployment-scanner to deploy my app. I'm not even sure if adding a MANIFEST.MF is necessary, or if adding ear-subdeployments-isolated should make all subdeployments visible to one another without any additional configuration.
I'm still looking into restructuring my app, just thought I'd try this first.
-
6. Re: Migrating ant + JBoss AS 5 project to JBoss AS 7
redmond007 Aug 15, 2011 10:02 AM (in response to redmond007)I discovered that JBoss AS7 does not support HAR Hibernate archive format. This is why my subdeployments weren't able to see each other's classes.