users@jersey.java.net

Re: java.lang.NullPointerException on Android

From: Lucas Ventura <useyour.mind_at_gmail.com>
Date: Fri, 28 May 2010 02:21:31 -0700 (PDT)

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)


Paul Sandoz wrote:
>
>
> On Apr 9, 2010, at 8:39 PM, Lucas Ventura wrote:
>
>>
>> Hi!
>> I'm also trying to use Jersey on Android.
>> I've used the 1.1.5.1 version of the lib, but I receive the same
>> error.
>>
>> About your last question
>>
>> Paul Sandoz wrote:
>>>
>>>
>>> On Dec 29, 2009, at 8:01 PM, Николай Панфилов wrote:
>>>
>>> Does Android require you to compile the Jersey source into something
>>> other than Java byte code and package it up a little differently?
>>>
>> Yes, it does. It recompiles the .class files into .dex files (Dalvik
>> Virtual
>> Machine specific bytecode).
>> Is there any problem?
>
> Not sure. It may be that you just need to package up the META-INF/
> services files.
>

I'm including the *.jar as is.


Paul Sandoz wrote:
>
>> What it is supposed to do with the META-INF/services files?
>>
>
> Are you including those files in the android equivalent of a jar file?
>
> Also if you are merging say jersey-core, jersey-server etc together
> you may need to merge the contents of any META-INF/services of the
> same name.
>
> Jersey requires those files because they declare components for Jersey
> to function. Those files are really just a convention to define
> implementations of specific interfaces, the implementations of which
> Jersey requires to function correctly. Jersey attempts to class load
> those files.
>
> Paul.
>

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.
Is there anyway to define that implementations in code, not in that files?

Thanks!
-- 
View this message in context: http://jersey.576304.n2.nabble.com/java-lang-NullPointerException-on-Android-tp4212447p5112326.html
Sent from the Jersey mailing list archive at Nabble.com.