]
Brian Stansberry updated WFLY-8515:
-----------------------------------
Component/s: EE
Deployments fails if AsyncListener in WEB-INF/classes or in a jar in
WEB-INF/lib implements a class that isn't on the classpath
-------------------------------------------------------------------------------------------------------------------------------
Key: WFLY-8515
URL:
https://issues.jboss.org/browse/WFLY-8515
Project: WildFly
Issue Type: Feature Request
Components: EE
Affects Versions: 9.0.2.Final, 10.1.0.Final
Reporter: Andy Wilkinson
Assignee: Jason Greene
Attachments: wildfly-problem.zip
If a web application contains, anywhere in {{WEB-INF/classes}} or a jar in
{{WEB-INF/lib}}, an {{AsyncListener}} that implements an interface that isn't on the
classpath, deployment of the web application will fail. A concrete example is Spring
Framework's {{spring-web}} module which contains [such a
listener|https://github.com/spring-projects/spring-framework/blob/f716c8e...].
When a war file is deployed to Wildfly 9.0.2.Final with {{spring-web}} in {{WEB-INF/lib}}
deployment fails:
{noformat}
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start
service jboss.deployment.unit."bootapp.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."bootapp.war".POST_MODULE: WFLYSRV0153: Failed to process
phase POST_MODULE of deployment "bootapp.war"
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:163)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.LinkageError: Failed to link
org/springframework/http/server/reactive/ServletHttpHandlerAdapter$HandlerResultSubscriber
(Module "deployment.bootapp.war:main" from Service Module Loader)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:269)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:77)
at org.jboss.modules.Module.loadModuleClass(Module.java:560)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at
org.jboss.as.server.deployment.reflect.DeploymentClassIndex.classIndex(DeploymentClassIndex.java:54)
at
org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:85)
at
org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:156)
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/reactivestreams/Subscriber
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at
org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:353)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:432)
... 19 more
Caused by: java.lang.ClassNotFoundException: org.reactivestreams.Subscriber from [Module
"deployment.bootapp.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:205)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:455)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:404)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:385)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:130)
... 23 more
{noformat}
This listener is only ever actually registered when the {{Subscriber}} class is on the
classpath so it seems unreasonable for it to cause a failure at deployment time.
I'll attach a very basic example that triggers a similar problem. In the case of the
example it fails with the following upon deployment to Wildfly 10.1.0.Final:
{noformat}
15:52:51,752 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001:
Failed to start service jboss.deployment.unit."wildfly-problem.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."wildfly-problem.war".POST_MODULE: WFLYSRV0153: Failed to
process phase POST_MODULE of deployment "wildfly-problem.war"
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoClassDefFoundError: Failed to link com/example/BrokenAsyncListener
(Module "deployment.wildfly-problem.war:main" from Service Module Loader):
org/reactivestreams/Subscriber
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:606)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:21)
at org.jboss.as.ee.utils.ClassLoadingUtils.loadClass(ClassLoadingUtils.java:14)
at
org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:84)
at
org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:76)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
{noformat}