I'm trying to set up a simple proof of concept Rest service using a Stateless
EJB bean deployed into OpenEJB. I'm using openejb 4.6.0.2

Aug 04, 2015 4:14:15 PM org.apache.openejb.server.SimpleServiceManager start
INFO: Can't start service cxf-rs
java.lang.NullPointerException
    at
org.apache.openejb.server.rest.RESTService.deployApplication(RESTService.java:450)
    at
org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:231)
    at
org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:610)
    at
org.apache.openejb.server.rest.RESTService.start(RESTService.java:898)
    at
org.apache.openejb.server.SimpleServiceManager.start(SimpleServiceManager.java:171)
    at
org.apache.openejb.server.ServiceManager.start(ServiceManager.java:131)
    at org.apache.openejb.server.Server.start(Server.java:95)
    at org.apache.openejb.server.Main.initServer(Main.java:157)
    at org.apache.openejb.server.Main.main(Main.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.openejb.cli.MainImpl.main(MainImpl.java:146)
    at org.apache.openejb.cli.Bootstrap.main(Bootstrap.java:105)
The null pointer is thrown on this call:

final RsRegistry.AddressInfo address =
rsRegistry.createRsHttpListener(contextRoot, listener, classLoader,
nopath.substring(NOPATH_PREFIX.length() - 1), virtualHost, auth, realm);

virtualHost, realm and auth all appear set in the openejb properties. The
contextRoot should default to the war name, but even when I set a
servlet-mapping in the web.xml this problem remains.

I tried to use jersey instead of the cxf rs implementation, this required
setting the java.naming.factory.initial in a jndi.properties, when I assumed
this would default to a sensible convention, however the same error
appeared.

If I remove the cxf jars from the openejb lib, the application starts
without error, but the rest endpoints don't respond, and there's no trace of
the classes in the openejb-init.log.

I'm using a very simple Class, based on the ApacheTomee examples pages. 


import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ejb.Stateless;

@Stateless
@Path("/hello")
public class HelloWorld {


    @GET
    @Path("/message")
    public String getMessage() {

         return "Hello from Rest";
    }
}

I've tried this with, and without a class extending Application, as per some
of the other Tomee examples and I'm running out of ideas to try to get this
running.



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/OpenEJB-Rest-Service-cxf-null-pointer-tp4675746.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to