users@jersey.java.net

Re: [Jersey] NullpointerException

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 27 Jan 2009 21:57:34 +0100

Hi Allan,

Yes, a number of developers encountered this and an issue was logged.
This is a bug that has been fixed in the 1.0.2-SNAPSHOT.

The problem is due to abstract Spring beans.

Paul.

On Jan 27, 2009, at 9:36 PM, Allan Ditzel wrote:

> We have Jersey integrated into our project, but recently we have
> started seeing a null pointer exception when deploying our
> application. Here is the stack trace:
>
> SEVERE: Exception occurred when intialization
> java.lang.NullPointerException
> at
> com.sun.jersey.api.core.ResourceConfig.isProviderClass(ResourceConfig
> .java:421)
> at
> com.sun.jersey.spi.spring.container.SpringComponentProviderFactory.re
> gister(SpringComponentProviderFactory.java:88)
> at
> com.sun.jersey.spi.spring.container.SpringComponentProviderFactory.<i
> nit>(SpringComponentProviderFactory.java:81)
> at
> com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(Sp
> ringServlet.java:80)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.load(ServletCon
> tainer.java:540)
> at
> com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletCon
> tainer.java:207)
> at
> org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.
> java:1172)
> at
> org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:99
> 2)
> at
> org.apache.catalina.core.StandardContext.loadOnStartup(StandardContex
> t.java:4058)
> at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4
> 371)
> at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
> .java:791)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
> 1)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
>
> at
> org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
> a:926)
> at
> org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.j
> ava:889)
> at
> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492
> )
> at
> org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
> at
> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
> :311)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
> eSupport.java:117)
> at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
>
> at
> org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
> at
> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
>
> at
> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443
> )
> at
> org.apache.catalina.core.StandardService.start(StandardService.java:5
> 16)
> at
> org.apache.catalina.core.StandardServer.start(StandardServer.java:710
> )
> at org.apache.catalina.startup.Catalina.start(Catalina.java:
> 578)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
> at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:
> 413)
>
> It seems, from looking at the code, that the
> springContext.getType(name) (line 87 in
> SpringComponentProviderFactory) is returning null, or that it
> doesn't know what type one of the spring beans it's iterating
> through is.
>
> Has anyone encountered anything like this at all?
>
> Thanks,
>
> Allan