java - CDI: Interface from jar cannot be resolved as Local Wildfly 8.0 -
i trying migrate existing java 7 application jboss 7.1 wildfly 8.0 , facing problems cdi.
the structure of project following:
ear | |--> base.service.impl.war |--> mad.impl.war --> contains sessionserviceimpl.class |--> lib | |-> base.api.jar |-> base.api.impl.jar --> contains sessionservice.class
sessionservice plain java interface no annotations. sessionserviceimpl looks this:
@stateless @ejb(name = sessionservice.jndi_name, beaninterface = sessionservice.class) public class sessionserviceimpl implements sessionservice { }
the ejb seems registered:
info [org.jboss.as.ejb3.deployment.processors.ejbjndibindingsdeploymentunitprocessor] (msc service thread 1-1) jndi bindings session bean named sessionserviceimpl in deployment unit subdeployment "com.mad.impl.war" of deployment "com.deployment.ear.ear" follows: java:global/com.server.deployment.ear/com.mad.impl/sessionserviceimpl!com.base.session.sessionservice java:app/com.mad.impl/sessionserviceimpl!com.base.session.sessionservice java:module/sessionserviceimpl!com.base.session.sessionservice java:global/com.deployment.ear/com.mad.impl/sessionserviceimpl java:app/com.mad.impl/sessionserviceimpl java:module/sessionserviceimpl
but after when cdi container starts deployment getting following error:
error [org.jboss.msc.service.fail] (msc service thread 1-2) msc000001: failed start service jboss.deployment.unit."com.deployment.ear.ear".weldstartservice: org.jboss.msc.service.startexception in service jboss.deployment.unit."com.deployment.ear.ear".weldstartservice: failed start service @ org.jboss.msc.service.servicecontrollerimpl$starttask.run(servicecontrollerimpl.java:1904) [jboss-msc-1.2.0.final.jar:1.2.0.final] @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1145) [rt.jar:1.7.0_45] @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:615) [rt.jar:1.7.0_45] @ java.lang.thread.run(thread.java:744) [rt.jar:1.7.0_45] caused by: org.jboss.msc.service.servicenotfoundexception: service service jboss.deployment.subunit."com.deployment.ear.ear"."com.mad.impl.war".component.sessionserviceimpl.view."com.base.session.sessionservice".local not found
i've tried annotate interface @local, didn't helped.
maven ear-plugin configuration following:
<plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-ear-plugin</artifactid> <version>2.8</version> <configuration> <version>6</version> <initializeinorder>true</initializeinorder> <defaultlibbundledir>/lib</defaultlibbundledir> <modules> <jarmodule> <groupid>mygroup</groupid> <artifactid>com.base.impl</artifactid> </jarmodule> <webmodule> <groupid>mygroup</groupid> <artifactid>com.base.service.impl</artifactid> <contextroot>/impl.base.server</contextroot> <bundlefilename>com.base.impl.war</bundlefilename> </webmodule> <webmodule> <groupid>mygroup</groupid> <artifactid>com.mad.impl</artifactid> <contextroot>/impl.mad.server</contextroot> <bundlefilename>com.mad.impl.war</bundlefilename> </webmodule> </modules> </configuration> </plugin>
the problem stateless bean. cdi has problems injecting remote interfaces session beans. error shows you, trying inject local interface sessionserviceimpl, cannot happen, since ejb container (based on ejb spec) has exposed remote interface since sessionserviceimpl implements sessionservice, , not annotated @localbean.
note ejb3.1:
- if session bean implements interface other serializable, comparable, externalizable, implemented interface considered remote interface bean.
- additionally, have defined, using @ejb annotation, remote interface sessionserviceimpl, , hence not placed in local namespace, in remote namespace.
Comments
Post a Comment