java - CDI injection fails when two copies of implementation exists -
i've following issue. reasons have copy of jar in 2 different war modules inside 1 ear. unfortunately introducing injection via cdi fails because classloader detects 2 implementations , doesn't know 1 should used. there's error :
07:28:35,411 error [org.jboss.msc.service.fail] (serverservice thread pool -- 215) msc000001: failed start service jboss.undertow.deployment.default-server.default-host./webadm: org.jboss.msc.service.startexception in service jboss.undertow.deployment.default-server.default-host./webadm: java.lang.runtimeexception: javax.servlet.servletexception: ut010013: not instantiate com.adminconsole.sessionobserver @ org.wildfly.extension.undertow.deployment.undertowdeploymentservice$1.run(undertowdeploymentservice.java:85) @ java.util.concurrent.executors$runnableadapter.call(executors.java:511) @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) @ org.jboss.threads.jbossthread.run(jbossthread.java:320) caused by: java.lang.runtimeexception: javax.servlet.servletexception: ut010013: not instantiate com.wincor.adminconsole.session.sessionobserver @ io.undertow.servlet.core.deploymentmanagerimpl.deploy(deploymentmanagerimpl.java:231) @ org.wildfly.extension.undertow.deployment.undertowdeploymentservice.startcontext(undertowdeploymentservice.java:100) @ org.wildfly.extension.undertow.deployment.undertowdeploymentservice$1.run(undertowdeploymentservice.java:82) ... 6 more caused by: javax.servlet.servletexception: ut010013: not instantiate com.adminconsole.sessionobserver @ io.undertow.servlet.core.managedlistener.start(managedlistener.java:50) @ io.undertow.servlet.core.applicationlisteners.start(applicationlisteners.java:159) @ io.undertow.servlet.core.deploymentmanagerimpl.deploy(deploymentmanagerimpl.java:173) ... 8 more caused by: java.lang.illegalstateexception: wflyee0042: failed construct component instance @ org.jboss.as.ee.component.basiccomponent.constructcomponentinstance(basiccomponent.java:163) @ org.jboss.as.ee.component.basiccomponent.constructcomponentinstance(basiccomponent.java:134) @ org.jboss.as.ee.component.basiccomponent.createinstance(basiccomponent.java:88) @ org.jboss.as.ee.component.componentregistry$componentmanagedreferencefactory.getreference(componentregistry.java:149) @ org.wildfly.extension.undertow.deployment.undertowdeploymentinfoservice$6.createinstance(undertowdeploymentinfoservice.java:1372) @ io.undertow.servlet.core.managedlistener.start(managedlistener.java:48) ... 10 more caused by: java.lang.illegalargumentexception: can not set com.adminconsole.jsf.context.ocminitfacescontextfactory field com.adminconsole.sessionobserver.contextfactory com.adminconsole.jsf.context.ocminitfacescontextfactory$proxy$_$$_weldclientproxy @ sun.reflect.unsafefieldaccessorimpl.throwsetillegalargumentexception(unsafefieldaccessorimpl.java:167) @ sun.reflect.unsafefieldaccessorimpl.throwsetillegalargumentexception(unsafefieldaccessorimpl.java:171) @ sun.reflect.unsafeobjectfieldaccessorimpl.set(unsafeobjectfieldaccessorimpl.java:81) @ java.lang.reflect.field.set(field.java:764) @ org.jboss.weld.injection.fieldinjectionpoint.inject(fieldinjectionpoint.java:94) @ org.jboss.weld.util.beans.injectboundfields(beans.java:363) @ org.jboss.weld.util.beans.injectfieldsandinitializers(beans.java:374) @ org.jboss.weld.injection.producer.defaultinjector$1.proceed(defaultinjector.java:71) @ org.jboss.weld.injection.injectioncontextimpl.run(injectioncontextimpl.java:48) @ org.jboss.weld.injection.producer.defaultinjector.inject(defaultinjector.java:73) @ org.jboss.weld.injection.producer.basicinjectiontarget.inject(basicinjectiontarget.java:121) @ org.jboss.as.weld.injection.weldinjectioncontext.inject(weldinjectioncontext.java:39) @ org.jboss.as.weld.injection.weldinjectioninterceptor.processinvocation(weldinjectioninterceptor.java:51) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.as.ee.component.aroundconstructinterceptorfactory$1.processinvocation(aroundconstructinterceptorfactory.java:28) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.as.weld.injection.weldinterceptorinjectioninterceptor.processinvocation(weldinterceptorinjectioninterceptor.java:56) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.as.weld.injection.weldinjectioncontextinterceptor.processinvocation(weldinjectioncontextinterceptor.java:43) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.as.ee.concurrent.concurrentcontextinterceptor.processinvocation(concurrentcontextinterceptor.java:45) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.invocation.contextclassloaderinterceptor.processinvocation(contextclassloaderinterceptor.java:64) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.invocation.interceptorcontext.run(interceptorcontext.java:356) @ org.jboss.invocation.privilegedwithcombinerinterceptor.processinvocation(privilegedwithcombinerinterceptor.java:80) @ org.jboss.invocation.interceptorcontext.proceed(interceptorcontext.java:340) @ org.jboss.invocation.chainedinterceptor.processinvocation(chainedinterceptor.java:61) @ org.jboss.as.ee.component.basiccomponent.constructcomponentinstance(basiccomponent.java:161) ... 15 more
ocminitfacescontextfactory injected sessionobserver via @inject annotation
it's sure it's caused duplication, because without copied jar works fine.
no question is, there way tell cdi (weld) search dependency in 1 war module ? trying exclude scan (in beans.xml in 1 of jar files) it's not point won't inject them @ all. can't change design of ear , war files.
Comments
Post a Comment