2 Replies Latest reply: Feb 13, 2012 5:48 AM by 694243 RSS

    EJB 3.0 injection in a web service

      Hello, I have the following situation:

      I have a defined remote EJB in an EAR:
      @Stateless(mappedName = "MyTestService")
      public class MyTestService {
        public String doThis() {return "done";}
      In another WAR, which is not part of the EAR and is deployed separately in WebLogic 12 I have a webservice:
      public class MyTestWebService {
        @EJB(mappedName = "MyTestService")
        private MyTestService testSvc;
        public String serveTheWeb() {
          return testSvc.doThis();
      Is this the right way to make the injection? Is it possible to make the injection at all? I suppose the WAR and the EAR files are deployed in the same container, so I suppose the EJB from the EAR will be available for the web service.

      Thanks in advance!