users@jersey.java.net

Using Jersey on Android

From: Martin Mörner <moerner.martin_at_googlemail.com>
Date: Tue, 09 Jun 2009 20:05:28 +0200

Hello everybody!

I'm a student in a mobile development group and we are trying to build a
REST Client for Android. Our first thougt, was using Jersey cause to the
easy use and parsing of XML <-> Object. But since we ported this on
android it seems to cause a NullPointerException:

private Client client = new Client();
private WebResource wr = new WebResource();
private OwnObjectType object = new OwnObjectType();
...

wr = client.resource(URL);
try {
            wr.accept(MediaType.APPLICATION_XML_TYPE);
            object = wr.get(OwnObjectType.class);
        }

Building this with the included Jersey Libs is working fine, but when
executed the wr.get() throws a NullPointerExecption from internal
Jersey Libs @getMediaType. The same code runs fine in a "normal" Java-App.

Does anyone know, how to get this working?

Best Regards,

Martin