users@glassfish.java.net

Resource injection in SessionBeans implementing javax.xml.ws.Provider

From: <glassfish_at_javadesktop.org>
Date: Wed, 02 Apr 2008 04:39:35 PST

Hi,

I have been trying to create a JAX-WS web service as a stateless session bean implementing javax.xml.ws.Provider:

@Stateless
@WebServiceProvider(
        portName="port1",
        serviceName="service1",
        targetNamespace="http://j2ee.netbeans.org/wsdl/service",
        wsdlLocation="META-INF/wsdl/service.wsdl")
@ServiceMode(Mode.MESSAGE)
public class ServiceBeanBean implements Provider<SOAPMessage>, ServiceBeanLocal {
    
    private static final Logger LOG = Logger.getLogger(ServiceBeanBean.class.getName());
    @EJB
    private ReferencedLocal ref;
    
    public SOAPMessage invoke(SOAPMessage arg0)
    {
        ref.test();
        return null;
    }
}

When I deploy this to glassfish v2 UR1 and I invoke the service via HTTP I get a NullPointerException indicating that the [i]ref[/i] EJB reference has not been injected into the bean by the container. I assume this is because the [i]invoke()[/i] method is handled by Metro instead of the EJB container, right? However, I think since it still is a SessionBean this should work anyway, shouldn't it?

Kai
[Message sent by forum member 'hudalla' (hudalla)]

http://forums.java.net/jive/thread.jspa?messageID=267282