users@jersey.java.net

Re: [Jersey] Re: NPE thrown by ContainerRequest

From: Paul Sandoz <Paul.Sandoz_at_oracle.com>
Date: Wed, 6 Oct 2010 11:36:11 +0200

Hi,

Can you send me your servlet log when you deploy and make 2 or more
requests?

I want to understand which NPEs are occurring as in this thread we are
discussing 2 NPEs:

1) At deployment (which if the servlet is lazy initialized will occur
on the first request)

java.lang.NullPointerException
        at
com
.sun
.jersey
.server
.impl
.cdi
.CDIComponentProviderFactory.<init>(CDIComponentProviderFactory.java:94)
        at
com
.sun
.jersey
.server
.impl
.cdi
.CDIComponentProviderFactoryInitializer
.initialize(CDIComponentProviderFactoryInitializer.java:75)
        at
com
.sun
.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:
554)
        at com.sun.jersey.spi.container.servlet.ServletContainer
$InternalWebComponent.configure(ServletContainer.java:280)
        at
com
.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:
586)
        at
com
.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:
213)
        at
com
.sun
.jersey
.spi.container.servlet.ServletContainer.init(ServletContainer.java:342)
        at
com
.sun
.jersey
.spi.container.servlet.ServletContainer.init(ServletContainer.java:516)
        at javax.servlet.GenericServlet.init(GenericServlet.java:244)

2) On request processing.

java.lang.NullPointerException
        at
com
.sun
.jersey.spi.container.ContainerRequest.<init>(ContainerRequest.java:182)
        at
com
.sun
.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:
383)
        at
com
.sun
.jersey
.spi.container.servlet.ServletContainer.service(ServletContainer.java:
497)
        at
com
.sun
.jersey
.spi.container.servlet.ServletContainer.service(ServletContainer.java:
684)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)

Paul.

On Oct 5, 2010, at 10:02 PM, NBW wrote:

> Hi Paul,
>
> I only see the NPE when the a ReST request comes in. The logs during
> my app's WAR deployment are clean. This was with 3.1 nightly
> (10-5-10).
>
> -Noah
>
> On Tue, Oct 5, 2010 at 11:50 AM, Paul Sandoz
> <Paul.Sandoz_at_oracle.com> wrote:
> Hi,
>
> There is a known issue with the current version of Weld (the CDI
> implementation) that we attempted to work around with a hack but
> alas causes an NPE in some cases. We need to wait for a new version
> of Weld to be integrated to see if this issue is resolved.
>
> Given the stack trace in your previous email i do not know if they
> are related but the only way i can explain the former is if somehow
> an exception on servlet initialization (like the NPE below) does not
> result in deployment failure, so the servlet is in an indeterminate
> state and is able to receive requests.
>
> Can you re-verify if such NPE occurs at deployment that the servlet
> is still active?
>
> Paul.
>