[jboss-jira] [JBoss JIRA] Issue Comment Edited: (AS7-708) Ability to specify classloading exceptions to ignore similar to scanning-deployers-jboss-beans.xml
Richard Kennard (JIRA)
jira-events at lists.jboss.org
Mon May 2 23:17:18 EDT 2011
[ https://issues.jboss.org/browse/AS7-708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12599525#comment-12599525 ]
Richard Kennard edited comment on AS7-708 at 5/2/11 11:15 PM:
--------------------------------------------------------------
To elaborate on this issue:
1. JBoss AS 7 appears to have some functionality that scans classes in JARs upon deployment. Presumably it is looking for CDI/JPA/Bean Validation annotations (just a guess).
2. This functionality fails if the classes being scanned refer to other classes (either through field types or method parameters) that are not on the classpath. I do not believe it is realistic to expect to go hunting through all classes in a JAR and that all of them should resolve. It is quite common for a JAR to have optional dependencies.
3. JBoss AS 6 had (I think) a very similar scanning mechanism. There, you could configure /server/default/deployers/scanning-deployers-jboss-beans.xml to ignore certain exceptions. Many exceptions were ignored by default (including NoClassDefFoundError). I do not know what the equivalent is in AS 7.
4. I attach a WAR that fails to deploy on AS 7 (jboss-7.0.0.Beta3) with the following error. Basically, Spring is not on the classpath and metawidget-all.jar has an optional dependency on Spring. However AS 7 should be more forgiving if it is going to go calling Class.privateGetDeclaredFields():
13:03:04,475 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."catch-demo.war".INSTALL: org.jboss.msc.service.StartException in servi
ce jboss.deployment.unit."catch-demo.war".INSTALL: Failed to process phase INSTALL of deployment "catch-demo.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:108)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_20]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_20]
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/MessageSource
at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_20]
at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_20]
at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_20]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:53)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:65)
at org.jboss.as.ee.component.AbstractComponentDescription.prepareComponentConfiguration(AbstractComponentDescription.java:392)
at org.jboss.as.ee.component.AbstractComponentDescription.createComponentConfiguration(AbstractComponentDescription.java:363)
at org.jboss.as.ee.component.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:104)
at org.jboss.as.ee.component.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:67)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:102)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.MessageSource from [Module "deployment.catch-demo.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:184) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:357) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:329) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:306) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:100) [:1.0.0.Beta17]
... 14 more
was (Author: kennardconsulting):
To elaborate on this issue:
1. JBoss AS 7 appears to have some functionality that scans classes in JARs upon deployment. Presumably it is looking for CDI/JPA/Bean Validation annotations (just a guess).
2. This functionality fails if the classes being scanned refer to other classes (either through field types or method parameters) that are not on the classpath. I do not believe it is realistic to expect to go hunting through all classes in a JAR and that all of them should resolve. It is quite common for a JAR to have optional dependencies.
3. JBoss AS 6 had (I think) a very similar scanning mechanism. There, you could configure /server/default/deployers/scanning-deployers-jboss-beans.xml to ignore certain exceptions. Many exceptions were ignored by default (including NoClassDefFoundError). I do not know what the equivalent is in AS 7.
4. I attach a WAR that fails to deploy with the following error. Basically, Spring is not on the classpath and metawidget-all.jar has an optional dependency on Spring. However AS 7 should be more forgiving if it is going to go calling Class.privateGetDeclaredFields():
13:03:04,475 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.unit."catch-demo.war".INSTALL: org.jboss.msc.service.StartException in servi
ce jboss.deployment.unit."catch-demo.war".INSTALL: Failed to process phase INSTALL of deployment "catch-demo.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:108)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1675)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_20]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_20]
at java.lang.Thread.run(Thread.java:619) [:1.6.0_20]
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/MessageSource
at java.lang.Class.getDeclaredFields0(Native Method) [:1.6.0_20]
at java.lang.Class.privateGetDeclaredFields(Class.java:2291) [:1.6.0_20]
at java.lang.Class.getDeclaredFields(Class.java:1743) [:1.6.0_20]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:53)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:65)
at org.jboss.as.ee.component.AbstractComponentDescription.prepareComponentConfiguration(AbstractComponentDescription.java:392)
at org.jboss.as.ee.component.AbstractComponentDescription.createComponentConfiguration(AbstractComponentDescription.java:363)
at org.jboss.as.ee.component.ComponentInstallProcessor.deployComponent(ComponentInstallProcessor.java:104)
at org.jboss.as.ee.component.ComponentInstallProcessor.deploy(ComponentInstallProcessor.java:67)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:102)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.MessageSource from [Module "deployment.catch-demo.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:184) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:357) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:329) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:306) [:1.0.0.Beta17]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:100) [:1.0.0.Beta17]
... 14 more
> Ability to specify classloading exceptions to ignore similar to scanning-deployers-jboss-beans.xml
> --------------------------------------------------------------------------------------------------
>
> Key: AS7-708
> URL: https://issues.jboss.org/browse/AS7-708
> Project: Application Server 7
> Issue Type: Bug
> Reporter: Jason Porter
> Assignee: David Lloyd
> Attachments: catch-demo.war
>
>
> We need to be able to specify exceptions to ignore during classpath scanning. This was available in AS6, we need it in AS7, or something similar. Please see https://issues.jboss.org/browse/SEAMFORGE-156
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list