Weird Class Loading Issue So far not happy still with new class loading strategy
sanjay05222 Apr 17, 2015 10:42 PMI have a application war . which uses following .
1 Wildfly 8.2.0Final +Wildfly Camel Patch
2. War which uses Spring and its a Camel application.
More Details
I can see fuse folder in the modules\system which have spring framework some of the modules defined which are used by the wildfly-camel
my war also have the spring jars inside it as well. I can say that it is happening because of that but I am not able to resolve this issue.
I tried excluding totally the spring modules from the camel springs but it still fails due other dependency this same war works fine in the tomcat with out any issue
any guys experts in class modules might help me in suggesting what needs to be done here. I dont know why I am not abel to get some thumb rule in class loading so that I can resolve these issues whenever I migration the new application .
can any one explain me the class loading strategy inside the wildfly.
Summary
myCamelProject.war has spring jars and camel-wildfly also uses camel-spring and spring-framework jars which is configured as extension or a subsystem please let me know how should I make the war so that it works and doesn through below error we are migrating this application and deadlines are approaching ..any help would be great. for experts in class loading in widlfly it should be trivial thing to resolve.
Thanks in advance
I am deploying the war and getting below error
19:25:16,758 INFO [io.undertow.servlet] (MSC service thread 1-1) Initializing Spring root WebApplicationContext
19:25:16,762 INFO [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Root WebApplicationContext: initialization started
19:25:16,778 ERROR [org.springframework.web.context.ContextLoader] (MSC service thread 1-1) Context initialization failed: java.lang.LinkageError: loader constraint violation: when resolving
overridden method "org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.getResourcePatternResolver()Lorg/springframework/core/io/support/ResourcePatternResolver;
" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/web/context/support/AbstractRefreshableWebApplicationContext, and its superclas
s loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type ork.web.context.support.AbstractRefreshableWebApplicationContext.getResourcePatternResol
ver()Lorg/springframework/core/io/support/ResourcePatternResolver; used in the signature
at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_71]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585) [rt.jar:1.7.0_71]
at java.lang.Class.getConstructor0(Class.java:2885) [rt.jar:1.7.0_71]
at java.lang.Class.getDeclaredConstructor(Class.java:2058) [rt.jar:1.7.0_71]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104) [spring-beans-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:360) [spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293) [spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.5.RELEASE.jar:4.1.5.RELEASE]
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
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:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
19:25:16,865 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host."/ECIC-0.0.1": org.jboss.msc
.service.StartException in service jboss.undertow.deployment.default-server.default-host."/ECIC-0.0.1": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.getResource
PatternResolver()Lorg/springframework/core/io/support/ResourcePatternResolver;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/w
eb/context/support/AbstractRefreshableWebApplicationContext, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type ork.web.co
ntext.support.AbstractRefreshableWebApplicationContext.getResourcePatternResolver()Lorg/springframework/core/io/support/ResourcePatternResolver; used in the signature
at java.lang.Class.getDeclaredConstructors0(Native Method) [rt.jar:1.7.0_71]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2585) [rt.jar:1.7.0_71]
at java.lang.Class.getConstructor0(Class.java:2885) [rt.jar:1.7.0_71]
at java.lang.Class.getDeclaredConstructor(Class.java:2058) [rt.jar:1.7.0_71]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:104)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:360)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:173)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:193)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:87)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.start(UndertowDeploymentService.java:72)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
... 3 more
19:25:17,189 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) JBAS014613: Operation ("full-replace-deployment") failed - address: ([]) - failure descripti
on: {"JBAS014671: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/ECIC-0.0.1\"" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.d