java - Cannot invoke @Remote interface in separate ear -
this real newbie question appreciate help. have looked in other questions haven't found solution. maybe overlooking simple.
i deploying ear jboss has ejb module:
in ejb jar single bean, mybean @stateless.
the ejb jar has dependency on api jar. in api jar single @remote interface, myinterface.
this api jar in lib folder of ejb. mybean implements myinterface. deploy ear, , goes ok. deploying jboss eap 6.3.0. in theory bean should available other ears & wars.
then: have war simple rest class call remote myinterface. (the idea call remote bean war deployed separately ear has bean).
this gives me following error when deploy war:
weld-001408 unsatisfied dependencies type [myinterface] qualifiers [@default] @ injection point [[field] @inject private com.test.rest.messagerestservice.myinterface]
the rest class follows:
package com.test.rest; import javax.inject.inject; import javax.ws.rs.get; import javax.ws.rs.path; import javax.ws.rs.pathparam; import javax.ws.rs.core.response; import com.test.myinterface; @path("/message") public class messagerestservice { @inject private myinterface myinterface; @get @path("/{param}") public response printmessage(@pathparam("param") string msg) { final string result = myinterface.generatetext(msg); return response.status(200).entity(result).build(); } }
what doing wrong here? have beans.xml in meta-inf in both ear , ejb, , in war in src/main/webapp/web-inf/beans.xml.
i have put bean-discovery-mode="all" in beans.xml no joy. bean mybean (implementing remote interface) has no args constructor.
also: have api jar interface , ejb jar brought in dependencies in war. still gives "unsatisfied dependencies" error...
any ideas?
thanks
update: myinterface class:
package com.test; import javax.ejb.local; @local public interface myinterface { public string generatetext(string text); }
and mybean:
package com.mycompany; import javax.ejb.stateless; import com.test.myinterface; @stateless public class mybean implements myinterface { public mybean(){ } public string generatetext(string text) { return "hello there! " + text; } }
bindings:
19:11:22,679 info [org.jboss.as.ejb3.deployment.processors.ejbjndibindingsdeploymentunitprocessor] (msc service thread 1-1) jndi bindings session bean named mybean in deployment unit subdeployment "mavenenterpriseapp-ejb.jar" of deployment "mavenenterpriseapp-ear-1.0-snapshot.ear" follows: java:global/mavenenterpriseapp-ear-1.0-snapshot/mavenenterpriseapp-ejb/mybean!com.test.myinterface java:app/mavenenterpriseapp-ejb/mybean!com.test.myinterface java:module/mybean!com.test.myinterface java:global/mavenenterpriseapp-ear-1.0-snapshot/mavenenterpriseapp-ejb/mybean java:app/mavenenterpriseapp-ejb/mybean java:module/mybean
Comments
Post a Comment