7 Replies Latest reply on May 6, 2009 9:45 AM by ropalka

    EJB injection doesn’t work in Web Services in JBoss 5.1

      In the EJB3 topic http://www.jboss.org/index.html?module=bb&op=viewtopic&t=153488 I've been told to create a separate topic in this forum regarding one of my problems.

      According to JEE 5 specification (http://www.onjava.com/pub/a/onjava/2006/01/04/dependency-injection-java-ee-5.html) EJB injection should work not only in servlets, but also in web services, but it doesn't in JBoss 5.1.x.

      Example code for a web service (works in other containers, like GlassFish, WebLogic):

      @WebService
      public class Ws2Stateless
      {
       @EJB private StatelessSession sless;
      
       @WebMethod
       public String sayHello( @WebParam(name="yourName") String name )
       {
       return "Greeting from StatelessSessionBean: " + sless.sayHello(name);
       }
      }
      


      This example is based on an example from Sun (I can supply a complete example application that shows the problem).