users@jersey.java.net

Problem using Jersey client from openoffice java extension

From: Angel Luis Jimenez Martinez <soyangel_at_gmail.com>
Date: Tue, 22 Dec 2009 18:35:35 +0100

Hi,

I'm trying to use Jersey client library from inside an Openoffice extension.
The problem is that this simple code desn't work:

Client client = Client.create();
                WebResource webResource = client.resource("
http://ws.audioscrobbler.com/2.0/");

                MultivaluedMap queryParams = new MultivaluedMapImpl();
                queryParams.add("api_key", "LASTFM_API_KEY_HERE");
                queryParams.add("method", "album.search");
                queryParams.add("album", "believe");
                String s =
webResource.queryParams(queryParams).get(String.class);
                System.out.println(s);

Of course I have tested this from a console java program (using the same
libraries) and works perfectly.

I think that the problem is related to these messages outputted by
Openoffice when trying to execute this code:

Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class com.sun.jersey.core.impl.provider.header.LocaleProvider
implementing the provider interface
com.sun.jersey.spi.HeaderDelegateProvider is not found. The provider
implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class
com.sun.jersey.core.impl.provider.header.EntityTagProvider implementing the
provider interface com.sun.jersey.spi.HeaderDelegateProvider is not found.
The provider implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class
com.sun.jersey.core.impl.provider.header.MediaTypeProvider implementing the
provider interface com.sun.jersey.spi.HeaderDelegateProvider is not found.
The provider implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class
com.sun.jersey.core.impl.provider.header.CacheControlProvider implementing
the provider interface com.sun.jersey.spi.HeaderDelegateProvider is not
found. The provider implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class
com.sun.jersey.core.impl.provider.header.NewCookieProvider implementing the
provider interface com.sun.jersey.spi.HeaderDelegateProvider is not found.
The provider implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class com.sun.jersey.core.impl.provider.header.CookieProvider
implementing the provider interface
com.sun.jersey.spi.HeaderDelegateProvider is not found. The provider
implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class com.sun.jersey.core.impl.provider.header.URIProvider
implementing the provider interface
com.sun.jersey.spi.HeaderDelegateProvider is not found. The provider
implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class com.sun.jersey.core.impl.provider.header.DateProvider
implementing the provider interface
com.sun.jersey.spi.HeaderDelegateProvider is not found. The provider
implementation is ignored.
Dec 22, 2009 6:06:19 PM
com.sun.jersey.spi.service.ServiceFinder$LazyObjectIterator hasNext
WARNING: The class com.sun.jersey.core.impl.provider.header.StringProvider
implementing the provider interface
com.sun.jersey.spi.HeaderDelegateProvider is not found. The provider
implementation is ignored.
terminate called after throwing an instance of
'com::sun::star::uno::RuntimeException'

As no more stack trace messages where available I attached eclipse to debug
this code and using jersey's source found some place where a
MediaTypeProvider was instanced as null. So I think the solution is related
to those warnings.

If it helps I can provide a simple Netbeans project with this code.

Thanks in advance.

-- 
Angel.