[jboss-user] [JBossWS] - EJB injection doesn’t work in Web Services in JBoss 5.1

japase do-not-reply at jboss.com
Fri Apr 17 08:28:24 EDT 2009


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).


View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4226183#4226183

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4226183



More information about the jboss-user mailing list