You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Temeraire <a....@gmail.com> on 2015/08/05 20:24:46 UTC

OpenEJB Rest Service - cxf null pointer

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.

Re: OpenEJB Rest Service - cxf null pointer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
we got several fixes since 4.6.0.2 so can be a bug, do you care testing on
localhost/some-webapp-name-but-not-root just to sanity check the instance
is properly setup


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-06 13:32 GMT-07:00 Temeraire <a....@gmail.com>:

> I've tried it in a scratch environment with 4.7.2 and it works quite
> happily
> with absolutely no effort and no additional configuration.
>
> Which is sort of irritating as the main environment that I'm using can't be
> update for various reasons too frustrating to mention.
>
> The 4.6.0.2 environment a RedHat linux 5 machine. Is there anywhere that I
> could be looking for more logs or any bit of information or configuration
> record somewhere that might explain the original error?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/OpenEJB-Rest-Service-cxf-null-pointer-tp4675746p4675773.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: OpenEJB Rest Service - cxf null pointer

Posted by Temeraire <a....@gmail.com>.
I've tried it in a scratch environment with 4.7.2 and it works quite happily
with absolutely no effort and no additional configuration. 

Which is sort of irritating as the main environment that I'm using can't be
update for various reasons too frustrating to mention.

The 4.6.0.2 environment a RedHat linux 5 machine. Is there anywhere that I
could be looking for more logs or any bit of information or configuration
record somewhere that might explain the original error?



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

Re: OpenEJB Rest Service - cxf null pointer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
I would suggest you to try the 4.7.2 and if you still have the issue share
a project on github to let us reproduce it.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-06 2:55 GMT-07:00 Temeraire <a....@gmail.com>:

> All the openejb dependencies including openejb-cxf-* are the same 4.6.0.2
> version.
> Are there any additional outputs I could be looking at? I checked the
> linked
> github example project, it has no web deployment config files, web.xmls etc
> and code wise looks identical to what I have.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/OpenEJB-Rest-Service-cxf-null-pointer-tp4675746p4675764.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: OpenEJB Rest Service - cxf null pointer

Posted by Temeraire <a....@gmail.com>.
All the openejb dependencies including openejb-cxf-* are the same 4.6.0.2
version.
Are there any additional outputs I could be looking at? I checked the linked
github example project, it has no web deployment config files, web.xmls etc
and code wise looks identical to what I have.



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

Re: OpenEJB Rest Service - cxf null pointer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Can you check your dependencies versions? Ie dont mix up cxf and openejb
versions for instance.
Le 6 août 2015 01:18, "Temeraire" <a....@gmail.com> a écrit :

> No. This is the full extent of the error message in the openejb-init.log.
> Which is the only file specified in the logging.properties file. The
> logging
> level is set to info, but changing to Debug doesn't show any more data.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/OpenEJB-Rest-Service-cxf-null-pointer-tp4675746p4675760.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: OpenEJB Rest Service - cxf null pointer

Posted by Temeraire <a....@gmail.com>.
No. This is the full extent of the error message in the openejb-init.log.
Which is the only file specified in the logging.properties file. The logging
level is set to info, but changing to Debug doesn't show any more data.



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

Re: OpenEJB Rest Service - cxf null pointer

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi

You should get a caused by no?
Le 5 août 2015 11:38, "Steve Goldsmith" <sg...@gmail.com> a écrit :

> This example https://github.com/sgjava/tomee-jaxrs-test uses JAX-RS to
> marshall a simple DTO and includes client timeouts.
>
> On Wed, Aug 5, 2015 at 2:24 PM, Temeraire <a....@gmail.com> wrote:
>
> > 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.
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: OpenEJB Rest Service - cxf null pointer

Posted by Steve Goldsmith <sg...@gmail.com>.
This example https://github.com/sgjava/tomee-jaxrs-test uses JAX-RS to
marshall a simple DTO and includes client timeouts.

On Wed, Aug 5, 2015 at 2:24 PM, Temeraire <a....@gmail.com> wrote:

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



-- 
Steven P. Goldsmith