Well @Inject will not rely on JNDI and NoClassDefFoundError means your service can't see your EJB. Is the EJB in the webapp and the service in the ear lib part?
Also didn't see the version you are using of tomee, are you using last ones? Romain Manni-Bucau @rmannibucau <https://twitter.com/rmannibucau> | Blog <http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> | LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber <http://www.tomitribe.com> | JavaEE Factory <https://javaeefactory-rmannibucau.rhcloud.com> 2016-05-12 17:45 GMT+02:00 jolinnen <[email protected]>: > Hi, > thanks for your quick reply. > Okay, I change to > > @Stateless > @Startup > @LocalBean > @Remote(WMAuthEJB.class) > public class WMAuthEJBImpl > implements WMAuthEJB > { > } > > and > > // @Stateless > // @Singleton > @Path("/") > public class WMAuthService > { > /* > @EJB > private WMAuthEJB wmauth; > */ > @Inject > private WMAuthEJBImpl wmauth; > > and the error has changed: > > SEVERE: error invoking > org.apache.tomee.webservices.TomeeJaxRsService@23d29c10 > java.lang.NoClassDefFoundError: LWMAuthEJBImpl; > at java.lang.Class.getDeclaredFields0(Native Method) > at java.lang.Class.privateGetDeclaredFields(Class.java:2317) > at java.lang.Class.getDeclaredFields(Class.java:1762) > at > > org.apache.openejb.server.cxf.rs.Contexts.findContextFields(Contexts.java:53) > at > > org.apache.openejb.server.cxf.rs.CdiResourceProvider.findContexts(CdiResourceProvider.java:131) > at > > org.apache.openejb.server.cxf.rs.CdiResourceProvider.<init>(CdiResourceProvider.java:103) > at > > org.apache.openejb.server.cxf.rs.OpenEJBPerRequestPojoResourceProvider.<init>(OpenEJBPerRequestPojoResourceProvider.java:28) > at > > org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deployApplication(CxfRsHttpListener.java:522) > at > > org.apache.openejb.server.rest.RESTService.deployApplication(RESTService.java:464) > at > > org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:275) > at > > org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:53) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > CDI complains. Maybe the EAR in apps have a different JNDI context than the > WAR in webapps? is it possible to browse the context? > > Thanks again. > > Cheers > > jolinnen > > > > > -- > View this message in context: > http://tomee-openejb.979440.n4.nabble.com/Using-EJB-from-an-EAR-app-inside-a-webservice-in-a-different-WAR-tp4678407p4678409.html > Sent from the TomEE Users mailing list archive at Nabble.com. >
