users@jersey.java.net

Re: [Jersey] Re: java.lang.NullPointerException on Android

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 08 Jun 2010 12:53:24 +0200

On May 28, 2010, at 11:21 AM, Lucas Ventura wrote:

>
> Hi,
> After some time, I'm retrying, with the v1.2 of the Jersey.
> I've included in the project, the *.jars:
> jersey-bundle.jar
> (http://download.java.net/maven/2/com/sun/jersey/jersey-bundle/1.2/jersey-bundle-1.2.jar
> )
> jsr311-api.jar
> (http://download.java.net/maven/2/javax/ws/rs/jsr311-api/1.1/jsr311-api-1.1.jar
> )
> as told in the user guide
> (https://jersey.dev.java.net/nonav/documentation/latest/user-guide.html
> #core_client)
>

<snip>
>
> There is no specific *.jar. As far as I've readed, the precompiler
> doesn't
> reads the non-classes files, so I think that it is not reading the
> META-INF/services files.


OK.

I would be surprised if ClassLoader.getResources ceased to function
correctly to load resources (that method is used to load the META-INF/
services files). But a quick search does indicate others are having
similar issues with packaging and META-INF/services.



> Is there anyway to define that implementations in code, not in that
> files?
>

There might be a way. It is possible to override the META-INF/services
lookup by using the following method:

https://jersey.dev.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/spi/service/ServiceFinder.html
#setIteratorProvider
%28com.sun.jersey.spi.service.ServiceFinder.ServiceIteratorProvider%29

So you could provide your own implementation.

Paul.