users@jersey.java.net

Re: [Jersey] Nullpointer exception in ExceptionMapper on jersey 1.1.5 (but not in 1.1.2)

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 04 Mar 2010 13:20:08 +0100

Hi Morten,

This is issue 467 which is fixed in the 1.2-SNAPSHOT:

   https://jersey.dev.java.net/issues/show_bug.cgi?id=467

I presume that you added the @com.sun.jersey.spi.inject.Inject support
to the 1.1.5 version of your ExceptonMapper because that functionality
was not supported in 1.1.2-ea?

I will send another email about release plans.

Paul.

On Mar 3, 2010, at 11:09 PM, Morten wrote:

> After a long break from java/jersey work I just upgraded from jersey
> 1.1.2 to 1.1.5 and since then my exception mapper fails to
> instantiate.
>
> The exception I get is:
> SEVERE: The provider class, class
> com.myapp.controller.CustomExceptionMapper, could not be
> instantiated. Processing will continue but the class will not be
> utilized
> java.lang.NullPointerException
> at
> com
> .sun
> .jersey
> .server.impl.model.ResourceClass.processOptions(ResourceClass.java:
> 374)
> at
> com
> .sun
> .jersey
> .server.impl.model.ResourceClass.processMethods(ResourceClass.java:
> 323)
> at
> com
> .sun
> .jersey.server.impl.model.ResourceClass.<init>(ResourceClass.java:133)
>
> My mapper looks like this:
>
> @Provider
> public class CustomExceptionMapper implements
> ExceptionMapper<java.lang.Throwable> {
> private final Logger log =
> Logger.getLogger(CustomExceptionMapper.class.getName());
>
> private UriInfo uriInfo;
>
> @com.sun.jersey.spi.inject.Inject
> protected WebServer server;
>
> public CustomExceptionMapper(@Context UriInfo uriInfo) {
> this.uriInfo = uriInfo;
> }
>
> public Response toResponse(java.lang.Throwable ex) {
> // ...
> }
> }
>
>
> I suspect this is a bug in jersey... Any ideas/help would be
> appreciated ?
>
> BTW: Any plans for a maintaince release of jersey 1.1.x with
> bugfixes since release of 1.1.5 ?
>
> /Morten
>
>
>
> __________________________________________________
> Bruger du Yahoo!?
> Er du tręt af spam? Yahoo!Mail har den bedste spambeskyttelse, der
> findes
> http://dk.mail.yahoo.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>