Tomcat6 linkageError for javax.el.ExpressionFactory - jsf

I am porting an application from tomcat7, where it works fine, to tomcat6 since tomcat 7 is not yet supported by CloudBees which is a PAAS I am considering.
I am porting to tomcat 6.035. I think the el-api.jar being in both my java-ee dependency and on tomcat is my problem, but I can't see how to solve it. The error, and a fragment of my pom.xml are below:
POM: (these are the only 2 dependencies related to el-api, I think. I removed another, and have made the java-ee dependency scoped as "provided".
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.faces</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
SEVERE: Critical error during deployment:
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:695)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:246)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

You are correct, that is indeed the problem, and the way to resolve it is to remove it from your web app.

Related

"IllegalArgumentException: Can not set [EJB interface] field [managed bean field] to com.sun.proxy.$Proxy[some number]" with OmniFaces' #Eager

Injecting an EJB into a JSF managed bean in a multi-module Maven Java EE 7 Project fails both on Payara 4.x and 5.x as well as Glassfish 4.x and 5.x and WildFly 11.0.0.Final which makes me think that this is not a Payara/Glassfish bug as I thought initially[1].
A simple JSF backing bean in the WAR module
#Named
#ApplicationScoped
#Eager
public class Init {
#EJB
private InitService initService;
public Init() {
}
#PostConstruct
public void init() {
initService.init();
}
}
with EJB interface in the JAR module
#Local
public interface InitService {
void init();
}
and the implementation in the EJB module
#Stateless
public class DefaultInitService implements InitService {
#PersistenceContext
private EntityManager entityManager;
#Override
public void init() {
Long id = 1L;
MyEntity myEntity0 = entityManager.find(MyEntity.class, id);
if(myEntity0 == null) {
myEntity0 = new MyEntity(Long.MIN_VALUE, "myProperty");
entityManager.persist(myEntity0);
}
}
}
fails on Payara 4.1.2.174 because of
WARN: WELD-000718: No EEModuleDescriptor defined for bean archive with ID: payara-classloading-proxy-issue-web-1.0-SNAPSHOT_war.war. #Initialized and #Destroyed events for ApplicationScoped may be fired twice.
WARNUNG: Could not instantiate eager application scoped beans. Possibly the CDI application scope is not active. This is known to be the case in certain Tomcat and Jetty based configurations.
java.lang.IllegalStateException: Exception attempting to inject Local ejb-ref name=richtercloud.payara.classloading.proxy.issue.jar.Init/initService,Local 3.x interface =richtercloud.payara.classloading.proxy.issue.jar.InitService resolved to intra-app EJB DefaultInitService in module payara-classloading-proxy-issue-ejb-1.0-SNAPSHOT.jar,ejb-link=payara-classloading-proxy-issue-ejb-1.0-SNAPSHOT.jar#DefaultInitService,lookup=,mappedName=,jndi-name=,refType=Session into class richtercloud.payara.classloading.proxy.issue.jar.Init: Can not set richtercloud.payara.classloading.proxy.issue.jar.InitService field richtercloud.payara.classloading.proxy.issue.jar.Init.initService to com.sun.proxy.$Proxy254
at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:185)
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:46)
at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:117)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:140)
at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
at richtercloud.payara.classloading.proxy.issue.jar.Init$Proxy$_$$_WeldClientProxy.toString(Unknown Source)
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateBeans(EagerBeansRepository.java:135)
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateApplicationScoped(EagerBeansRepository.java:105)
at org.omnifaces.cdi.eager.EagerBeansRepository$Proxy$_$$_WeldClientProxy.instantiateApplicationScoped(Unknown Source)
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateApplicationScopedAndRegisterListenerIfNecessary(EagerBeansRepository.java:79)
at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:83)
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:4991)
at com.sun.enterprise.web.WebModule.contextListenerStart(WebModule.java:574)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5560)
at com.sun.enterprise.web.WebModule.start(WebModule.java:522)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:956)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:939)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:684)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2099)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1745)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:107)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:294)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:357)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:501)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:508)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:540)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:539)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:570)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:562)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:561)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1469)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1851)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1727)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:189)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:483)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:180)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Local ejb-ref name=richtercloud.payara.classloading.proxy.issue.jar.Init/initService,Local 3.x interface =richtercloud.payara.classloading.proxy.issue.jar.InitService resolved to intra-app EJB DefaultInitService in module payara-classloading-proxy-issue-ejb-1.0-SNAPSHOT.jar,ejb-link=payara-classloading-proxy-issue-ejb-1.0-SNAPSHOT.jar#DefaultInitService,lookup=,mappedName=,jndi-name=,refType=Session into class richtercloud.payara.classloading.proxy.issue.jar.Init: Can not set richtercloud.payara.classloading.proxy.issue.jar.InitService field richtercloud.payara.classloading.proxy.issue.jar.Init.initService to com.sun.proxy.$Proxy254
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:740)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:507)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:170)
at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:175)
... 68 more
Caused by: java.lang.IllegalArgumentException: Can not set richtercloud.payara.classloading.proxy.issue.jar.InitService field richtercloud.payara.classloading.proxy.issue.jar.Init.initService to com.sun.proxy.$Proxy254
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:688)
... 71 more
and on WildFly due to
04:52:16,873 WARNING [org.omnifaces.cdi.eager.EagerBeansRepository] (ServerService Thread Pool -- 81) Could not instantiate eager application scoped beans. Possibly the CDI application scope is not active. This is known to be the case in certain Tomcat and Jetty based configurations.: java.lang.IllegalArgumentException: Can not set richtercloud.payara.classloading.proxy.issue.jar.InitService field richtercloud.payara.classloading.proxy.issue.jar.Init.initService to richtercloud.payara.classloading.proxy.issue.jar.InitService$$$view3
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at org.jboss.weld.injection.FieldResourceInjection.injectMember(FieldResourceInjection.java:62)
at org.jboss.weld.injection.AbstractResourceInjection.injectResourceReference(AbstractResourceInjection.java:63)
at org.jboss.weld.util.Beans.injectEEFields(Beans.java:331)
at org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:69)
at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
at org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
at org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:117)
at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:140)
at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
at richtercloud.payara.classloading.proxy.issue.jar.Init$Proxy$_$$_WeldClientProxy.toString(Unknown Source)
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateBeans(EagerBeansRepository.java:135)
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateApplicationScoped(EagerBeansRepository.java:105)
at org.omnifaces.cdi.eager.EagerBeansRepository$Proxy$_$$_WeldClientProxy.instantiateApplicationScoped(Unknown Source)
at org.omnifaces.cdi.eager.EagerBeansRepository.instantiateApplicationScopedAndRegisterListenerIfNecessary(EagerBeansRepository.java:79)
at org.omnifaces.ApplicationListener.contextInitialized(ApplicationListener.java:83)
at io.undertow.servlet.core.ApplicationListeners.contextInitialized(ApplicationListeners.java:187)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:205)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:174)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow.security.SecurityContextThreadSetupAction.lambda$create$0(SecurityContextThreadSetupAction.java:105)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1508)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:239)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:99)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Maven dependencies of the WAR project are
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.1</version>
</dependency>
<dependency>
<groupId>richtercloud</groupId>
<artifactId>payara-classloading-proxy-issue-jar</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.6.7</version>
</dependency>
and of the JAR
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.14.1.0</version>
</dependency>
This is preceeding of, but not the same as How to use OmniFaces #Eager annotation with PrimeFaces? since in that question I didn't get any exception or other feedback even after logging was configured correctly.
An example project and GitLab CI output reproducing the issue on plain docker images can be found easily through the referenced issues (different AS on different branches and output on the corresponding CI pipeline sections)
[1] reported at https://github.com/payara/Payara/issues/2237 and https://github.com/javaee/glassfish/issues/22401 with a more reduced example which was related to proxy class cast exceptions as well, but didn't have weld involved in the stack.
The ...Proxy class cast exception issues resulted from the Maven compile scope of the JAR module (containing entities and EJB interfaces next to a WEB and EJB module containing EJB implementations) in the WEB module. This causes the EJB interface classes to be loaded by different class loaders (which is correct in this Java EE setup) so that they're considered different class by definition of how class loaders work.
The issue can be avoided by changing the scope to provided in the WEB module without any drawback.
The feedback of application servers (GlassFish and WildFly and possibly others) is horrible as with a lot of (Java EE) technologies and I suggested improvement, although I get the point that the golden rule that if your application works correctly you've done 20% of the work and now you need to deal with the remaining 80% for useful feedback in all possible situation will take some time (meaning decades) to be realized.

WELD Classloading issue after adding deltaspike to an existing primefaces maven project

I am new to primefaces and deltaspike, we initially tried with CDI conversations but had to fall back to deltaspike. I added the jars as mentioned in the https://deltaspike.apache.org/documentation/configure.html#config-maven-indep But I am getting a classloading issue with FacesMessages. I am not sure how to resolve this. Below are the logs and pom files.
11:05:14,056 WARN [org.jboss.modules] (Weld Thread Pool -- 1) Failed to define class javax.faces.application.FacesMessage in Module "javax.faces.api:main" from local module loader #66133adc (finder: local module finder #7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base)): java.lang.LinkageError: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader #66133adc (finder: local module finder #7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
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:605)
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.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.weld.annotated.slim.backed.SecurityActions.getDeclaredMethods(SecurityActions.java:41)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:194)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.computeValue(BackedAnnotatedType.java:188)
at org.jboss.weld.util.LazyValueHolder.get(LazyValueHolder.java:35)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$EagerlyInitializedLazyValueHolder.<init>(BackedAnnotatedType.java:156)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:188)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType$BackedAnnotatedMethods.<init>(BackedAnnotatedType.java:188)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.<init>(BackedAnnotatedType.java:63)
at org.jboss.weld.annotated.slim.backed.BackedAnnotatedType.of(BackedAnnotatedType.java:44)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:83)
at org.jboss.weld.resources.ClassTransformer$TransformClassToBackedAnnotatedType.load(ClassTransformer.java:80)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49)
at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:175)
at org.jboss.weld.resources.ClassTransformer.getBackedAnnotatedType(ClassTransformer.java:194)
at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:113)
at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.createContext(FastAnnotatedTypeLoader.java:102)
at org.jboss.weld.bootstrap.FastAnnotatedTypeLoader.loadAnnotatedType(FastAnnotatedTypeLoader.java:81)
at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:97)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:65)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$1.doWork(ConcurrentBeanDeployer.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
11:05:14,065 INFO [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 1) WELD-000119: Not generating any bean definitions from org.apache.deltaspike.jsf.impl.listener.request.DeltaSpikeFacesContextWrapper because of underlying class loading error: Type [unknown] not found. If this is unexpected, enable DEBUG logging to see the full error.
11:05:15,468 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."paris-ear.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."paris-ear.ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
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:
org.jboss.weld.exceptions.DeploymentException: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader #66133adc (finder: local module finder #7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:66)
at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43)
at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createProducersAndObservers(ConcurrentBeanDeployer.java:103)
at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:401)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more
Caused by:
java.lang.LinkageError: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader #66133adc (finder: local module finder #7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
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:605)
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.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.jboss.weld.security.GetDeclaredMethodsAction.run(GetDeclaredMethodsAction.java:30)
at org.jboss.weld.security.GetDeclaredMethodsAction.run(GetDeclaredMethodsAction.java:22)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.weld.util.reflection.Reflections.getNonPrivateNonStaticFinalMethod(Reflections.java:177)
at org.jboss.weld.util.Proxies.getUnproxyableClassException(Proxies.java:218)
at org.jboss.weld.util.Proxies.getUnproxyableTypeException(Proxies.java:180)
at org.jboss.weld.util.Proxies.getUnproxyableTypesExceptionInt(Proxies.java:192)
at org.jboss.weld.util.Proxies.getUnproxyableTypesException(Proxies.java:174)
at org.jboss.weld.util.Proxies.isTypesProxyable(Proxies.java:162)
at org.jboss.weld.bean.ProducerMethod.<init>(ProducerMethod.java:76)
at org.jboss.weld.bean.ProducerMethod.of(ProducerMethod.java:60)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.createProducerMethod(AbstractBeanDeployer.java:214)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.createProducerMethods(AbstractBeanDeployer.java:199)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.createObserversProducersDisposers(AbstractBeanDeployer.java:176)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$4.doWork(ConcurrentBeanDeployer.java:106)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$4.doWork(ConcurrentBeanDeployer.java:103)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:63)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:56)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
I understand that this is the root cause
java.lang.LinkageError: Failed to link javax/faces/application/FacesMessage (Module "javax.faces.api:main" from local module loader #66133adc (finder: local module finder #7bfcd12c (roots: C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules,C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base))): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "javax/faces/application/FacesMessage"
This is the content of my modules.xml under C:\Users\amoram\jbossstudio10\runtimes\jboss-eap\modules\system\layers\base\javax\faces\api\main and it also have my jboss-jsf-api_2.2_spec-2.2.12.redhat-1.jar
<module xmlns="urn:jboss:module:1.3" name="javax.faces.api">
<dependencies>
<module name="com.sun.jsf-impl" />
<module name="javax.enterprise.api" export="true" />
<module name="javax.servlet.api" export="true" />
<module name="javax.servlet.jsp.api" export="true" />
<module name="javax.servlet.jstl.api" export="true" />
<module name="javax.validation.api" export="true" />
<module name="org.glassfish.javax.el" export="true" />
<module name="javax.api" />
</dependencies>
<resources>
<resource-root path="jboss-jsf-api_2.2_spec-2.2.12.redhat-1.jar" />
</resources>
</module>
This is the snippet from my ejb module pom.xml
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-api</artifactId>
<version>${deltaspike.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.core</groupId>
<artifactId>deltaspike-core-impl</artifactId>
<version>${deltaspike.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-api</artifactId>
<version>${deltaspike.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-jsf-module-impl</artifactId>
<version>${deltaspike.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
</dependency>
Below is the snippet from Parent pom
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- java ee/servlet/cdi/ejb dependencies -->
<version.javaee7.web.spec>7.0</version.javaee7.web.spec>
<version.jboss-servlet-api_3.1_spec>1.0.0.Final</version.jboss-servlet-api_3.1_spec>
<version.cdi-api>1.2</version.cdi-api>
<version.jboss-ejb-api>1.0.0.Final</version.jboss-ejb-api>
<version.jsf>2.2.12</version.jsf>
<version.javax.inject>1</version.javax.inject>
<version.el-api>2.2.1</version.el-api>
<version.validation>1.1.0.Final</version.validation>
<version.primefaces>6.0</version.primefaces>
<version.primefaces.extensions>6.0.0</version.primefaces.extensions>
<version.themes>1.0.10</version.themes>
<!-- <version.hibernate-c3p0>4.3.2.Final</version.hibernate-c3p0> -->
<version.hibernate-entitymanager>5.0.9.Final</version.hibernate-entitymanager>
<version.hibernate-core>5.0.9.Final</version.hibernate-core>
<version.hibernate.validator>5.2.4.Final</version.hibernate.validator>
<version.hibernate-jpa>1.0.0.Final</version.hibernate-jpa>
<version.hibernate-annotation>3.5.6-Final</version.hibernate-annotation>
<version.hibernate-commons-annotation>4.0.5.Final</version.hibernate-commons-annotation>
<!-- <version.google.generic.dao>1.2.0</version.google.generic.dao> -->
<version.commons-collections>3.2.2</version.commons-collections>
<version.commons-lang>2.6</version.commons-lang>
<version.commons-lang3>3.3</version.commons-lang3>
<!--TODO required? -->
<version.commons-config>1.10</version.commons-config>
<version.common-beanutils>1.9.2</version.common-beanutils>
<version.common-email>1.4</version.common-email>
<version.common-exec>1.3</version.common-exec>
<version.commons-fileupload>1.3</version.commons-fileupload>
<!--TODO required? -->
<version.commons-codec>1.10</version.commons-codec>
<!--TODO required? -->
<version.poi>3.12</version.poi>
<version.joda-time>2.8.1</version.joda-time>
<version.ojdbc6>12.1.0.2</version.ojdbc6>
<version.dom4j>1.6.1</version.dom4j>
<version.jxl>2.6.12</version.jxl>
<version.xerces>2.11.0</version.xerces>
<version.javaassist>3.15.0-GA</version.javaassist>
<version.picketbox>4.0.7.Final</version.picketbox>
<resteasy.version>2.3.5.Final</resteasy.version>
<version.jgroups>3.6.4.Final</version.jgroups>
<version.jbosscache>3.2.11.GA</version.jbosscache>
<!-- <version.weldcore>2.3.3</version.weldcore> -->
<version.weldcore>3.0.0.Alpha6</version.weldcore>
<version.common-jxpath>1.3-redhat-3</version.common-jxpath>
<version.javamail>1.5.4</version.javamail>
<!-- Logging -->
<version.logback>1.1.5</version.logback>
<version.slf4j>1.7.16</version.slf4j>
<!-- Unit testing -->
<version.junit>4.12</version.junit>
<version.easymock>3.1</version.easymock>
<!-- pluggins -->
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
<!-- DeltaSpike -->
<deltaspike.version>1.7.2</deltaspike.version>
</properties>
<dependencyManagement>
<dependencies>
...
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<version>${version.jsf}</version>
</dependency>
</dependencies>
</dependencyManagement>
<!-- I did not have any delta spike dependency tags in parent pom, I mentioned them only in my ejb pom which is above this snippet -->
I wanted to attach my complete pom.xml files but didn't know how to do it, they are too big to add them like the modules.xml I did above. Can someone guide me please?
After I commented out the javax.faces.application.FacesMessage and all its occurrences from my controllers and service classes, the error disappeared. It looks like we cannot use deltaspike and jsf-api FacesMessage together as they create ambiguity?

request-channel in inbound-gateway pointing to wrong version class

I am migrating from spring integration 3.0.3 to spring integration 4.0.2.release and in my springIntegration.xml, I have defined a inbound-gateway (it was already there) but in that request-channel is pointing to version 3 class.
inbound gateway is
<integration-jms:inbound-gateway id="jmsInBoundA"
container="jmsListenerA"
auto-startup="true"
reply-delivery-persistent="false"
reply-priority="7"
message-converter="logMsgConverter"
extract-request-payload="true"
explicit-qos-enabled-for-replies="true"
reply-time-to-live="30000"
reply-timeout="70000"
extract-reply-payload="true"
request-channel="inputChannel"
error-channel="errorChannel"/>
But it is showing the error
"Cannot resolve required base class 'or.springframework.integration.MessageChannel'. I am not sure why is pointing to this class from integration package while it should use messaging package as per updated version automatically from classpath.
in pom.xml, I have defined:
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jms</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-xml</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms-api</artifactId>
<version>1.1-rev-1</version>
<scope>provided</scope>
</dependency>
We are using spring version 4.0.3 with this. Please help me to resolve this problem as even after changing to spring 4 why springintegration.xml is pointing to a class of spring 3.
And my all integration tests are failing as I am getting this error in stack trace:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99)
at org.springframework.test.context.DefaultTestContext.getApplicationContext(DefaultTestContext.java:101)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:319)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:212)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:232)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:175)
at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [spring/springIntegration.xml]; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:413)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:335)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:216)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:187)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:251)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadBeanDefinitions(AbstractGenericContextLoader.java:235)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:118)
at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:100)
at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:250)
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContextInternal(CacheAwareContextLoaderDelegate.java:64)
at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:91)
... 28 more
Caused by: java.lang.NullPointerException
at org.springframework.integration.config.PublisherRegistrar.registerBeanDefinitions(PublisherRegistrar.java:67)
at org.springframework.integration.config.IntegrationRegistrar.registerMessagingAnnotationPostProcessors(IntegrationRegistrar.java:319)
at org.springframework.integration.config.IntegrationRegistrar.registerBeanDefinitions(IntegrationRegistrar.java:93)
at org.springframework.integration.config.xml.AnnotationConfigParser.parse(AnnotationConfigParser.java:40)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:74)
at org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler.parse(AbstractIntegrationNamespaceHandler.java:56)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1424)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1414)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:187)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:141)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:110)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:508)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:391)
... 41 more
As long as you don't show any StackTrace, I guess that your IDE complains.
I see the same from my IDEA 13.1:
So, just ignore it, because IDEs don't support Spring Integration XSD 4.0, yet.
UPDATE
Good catch! It is really a bug. Whouldn't you mind to raise a JIRA issue (https://jira.spring.io/browse/INT) on the matter?
From other side it is a different question and I'll help you there with some workaround to get dir that NPE. Link it here and let's accept this answer to mark the question as resolved. I mean the IDEA issue.

IllegalArgumentException: duplicate key (JSF)

I'm using Tomcat 7, Richfaces 4.2.2, MyFaces 2.1.5 and Facelets. When I start Tomcat I get the error:
An error occured while initializing MyFaces: duplicate key: class javax.faces.convert.BooleanConverter
java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.BooleanConverter
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:115)
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:72)
at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:221)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:207)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:53)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:65)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:60)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:27)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:139)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:112)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:157)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:43)
at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2105)
at org.apache.myfaces.application.ApplicationImpl.access$000(ApplicationImpl.java:118)
at org.apache.myfaces.application.ApplicationImpl$SystemListenerEntry.publish(ApplicationImpl.java:2292)
at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:537)
at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:248)
at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:140)
at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:866)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:842)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
I saw the solution presented in this post, but different in this case, I don't have "-source.jar" in my classpath.
What else could be wrong?
I'm was the same boat as you are.
Taking off from the post you've linked to, I inspected all of my JAR files in WEB-INF/lib and found that both richfaces-components-ui-4.2.2.Final.jar and richfaces-ui-validator-ui-4.2.2.Final.jar contain a file META-INF/csv.xml which provides a mapping for the offending class (IntegerConverter, in my case).
I had the following Maven dependencies declared (with the RichFaces 4.2.2Final BOM listed earlier):
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.ui.validator</groupId>
<artifactId>richfaces-ui-validator-ui</artifactId>
</dependency>
HOWEVER, the richfaces-components-ui is a super-set of richfaces-ui-validator-ui (that is, contains it and a few others).
Your configuration / RichFaces components may be different, but the answer lies in what's in your WEB-INF/lib directory (whether it got there from Maven or some other way)... you've likely included more than one JAR with a csv.xml file.
Identify a minimal set of dependencies and the error will go away.

Tomcat 7 LinkageError: loader constraint violation

INFO: Deploying web application archive test-1.0-SNAPSHOT.war
20-Sep-2011 12:08:42 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\software\apache-tomcat-7.0.21\webapps\test-1.0-SNAPSHOT\WEB-INF\lib\servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
20-Sep-2011 12:08:42 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.1.0 (SNAPSHOT 20100817) for context '/test-1.0-SNAPSHOT'
20-Sep-2011 12:08:42 com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
20-Sep-2011 12:08:43 com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:684)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:240)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
20-Sep-2011 12:08:43 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:290)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:684)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:240)
... 8 more
20-Sep-2011 12:08:43 org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
20-Sep-2011 12:08:43 org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/test-1.0-SNAPSHOT] startup failed due to previous errors
I am trying to run mkyong hello world JSF2 example http://www.mkyong.com/jsf2/jsf-2-0-hello-world-example/
POM.xml is
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.0-b03</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.0-b03</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
This thread loader constraint violation describes same issue in tomcat 6 but it is not help to solve my issue.
I don't do Maven, but given the answer of Pascal Thivent in your linked question, it seems that you need to mark a Maven dependency as provided whenever the target runtime already ships with it out the box.
Tomcat as being a simple servletcontainer ships with JSP, Servlet and EL out the box (only not with JSF and JSTL). The exception message which you got indicates duplication of the JSP API in the classpath. I suggest to set the JSP and Servlet entries in your pom.xml to provided as well.
Further, you will get a second major problem after you fix the problem as stated in the question, Mojarra 2.1.0 does not work in Tomcat. Upgrade to Mojarra 2.1.1 or newer (it's currently at 2.1.3). See also the Mojarra download page for pom snippets.
commenting out
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
did the trick for me. It seems since jsp was already provided adding the dependency was unnecessary and producing the error
This answer is a supplementation of BalusC's answer. hope this will help.
Use Tomcat 7 as the container. You must consider the default Shared Library Files.
For me, there are such files in directory $TOMCATHOME/lib:
annotations-api.jar
catalina-ant.jar
catalina-ha.jar
...
jsp-api.jar
servlet-api.jar
...
That's why you have to mark servlet-api, jsp-api and el-ri as provided, or even exclude the JARs.
Try to put your jar file in your project BuildPath->Configure BuildPath->Libraries->Add External Jar..

Resources