dev@jersey.java.net

Re: [Jersey] NullPointerException in DefaultResourceConfig

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 05 Sep 2008 09:57:41 +0200

Ah! i think i know why.

WebLogic servlet does not support class scanning of the WEB-INF/lib
files as required by the Jersey servlet, namely
ServletContext.getRealPath returns a null value.

An exception should still be thrown, but by the application. I have
made the exceptions more meaningful and provide hints to use the
package scanning technique instead.

Would you be able to help me verify the messages on WebLogic when a
new build is ready? i will send another email when the build is done.

Thanks,
Paul.

On Sep 4, 2008, at 9:33 PM, Anthony, Clark (Mission Systems) wrote:

> I was attempting to use the
> "com.sun.jersey.config.property.packages" param that is recommended
> for Weblogic 9.2. I set it in Netbeans, but it turned out there was
> a disconnect between the visual editor and the actual xml, so it was
> not present. Therefore the default ClassPathResourceConfig was used.
> Not entirely sure why the null came through, but it did every time I
> tried to deploy.
>
> Ensuring that the property was actually set in the web.xml allowed
> me to continue.
>
> I was deploying directly from the admin console on a freshly
> installed Weblogic instance. This was my web.xml that failed:
>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd
> ">
>
> <servlet>
> <servlet-name>TrackAdapter</servlet-name>
> <servlet-
> class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-
> class>
> <load-on-startup>1</load-on-startup>
> </servlet>
> <servlet-mapping>
> <servlet-name>TrackAdapter</servlet-name>
> <url-pattern>/TrackAdapter/*</url-pattern>
> </servlet-mapping>
> <session-config>
> <session-timeout>30</session-timeout>
> </session-config>
> <welcome-file-list>
> <welcome-file>index.jsp</welcome-file>
> </welcome-file-list>
> </web-app>
>