You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by dN...@gmx.de on 2017/04/05 11:06:55 UTC
CXF Webservice with SoapOverJMS and EJB3 on JBoss
Hi guys,
im currently stuck with the following problem, maybe you can give me a hint to solve this (environment JBoss EAP 7.0.4)
EJB with one simple method, that should be used in a CXF Webservice with SoapOverJMS (deployment in one war)
The reference to the simpleEjb in the SimpleJMSEndpoint class is always null. Also annotations like @PostConstruct don't work in the SimpleJMSEndpoint.
Although if i'm doing a direct JNDI lookup, i can retrieve the EJB and make the method call (this works only if the SimpleEJB is also annotated with @EJB and the jndi name is set).
If i'm using an HTTPEndpoint the injection in the SimpleHTTPEndpoint class works fine. (deployed also in the same war)
Does anybody have a hint how to inject the ejb in case of JMS tranport using standard jee annotations or isn't this possible at all?
Thanks and regards,
Mitch
----------- EJB
@Stateless
@EJB(name = "java:global/SimpleEJB", beanInterface=SimpleEJB.class)
public class SimpleEJB {
public String getInfo() {
return "info";
}
}
----------------JMS-Endpoint
@WebService( serviceName = "SimpleService", portName = "JmsEndpointPort", wsdlLocation = "simpleservice.wsdl", targetNamespace = "http://services/samples/simple" )
@SOAPBinding( style = SOAPBinding.Style.RPC )
public class SimpleJMSEndpoint extends SimpleServiceEndpoint
{
@EJB
SimpleEJB ejb;
@WebMethod
@Override
public String getInfo( String in )
{
return ejb.getInfo(); // At this Point i get an NPE
}
}
------------------- HTTP-Endpoint
@WebService
public class SimpleHTTPEndpoint implements Simple
{
@EJB
SimpleEJB ejb;
@Override
public String getInfo( String in )
{
System.out.println( "Starting hTTP endpoint method getInfo" );
return ejb.getSomeString(); // Works fine
}
--------------------- direct JNDI lookup
Context initCtx = new InitialContext();
SimpleEJB ejb1 = (SimpleEJB) initCtx.lookup( "java:global/SimpleEJB" );