users@jersey.java.net

Re: [Jersey] Question

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 23 Sep 2009 16:48:36 +0200

Hi Benjamin,

What are your exact jar dependencies you are using?

Is there anything special about the client set up?

The error you are getting indicates the JAX-RS initialization is not
configured. There was a bug in earlier versions of the client where if
one did not include the jersey-server dependencies JAX-RS
initialization would not work correctly. But that was fixed a while
back.

Paul.

On Sep 19, 2009, at 6:59 AM, Benjamin Renaud wrote:

> Hi Everyone,
>
> I am using 1.1.2-ea, and while running a simple client get:
>
> BasicAuthenticationClientFilter authFilter =
> new BasicAuthenticationClientFilter("*******",
> "*******");
> Client client = Client.create();
> client.addFilter(authFilter);
> client.setFollowRedirects(true);
> WebResource webResource =
> client.resource("https://myserver.com/customers.xml");
> serviceSideKickData = webResource.get(String.class);
>
> I get:
>
> java.lang.NullPointerException
> at javax.ws.rs.core.MediaType.valueOf(MediaType.java:119)
> at
> com.sun.jersey.api.client.ClientResponse.getType(ClientResponse.java:
> 593)
> at
> com
> .sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
> 516)
> at
> com
> .sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:
> 491)
> at com.sun.jersey.api.client.WebResource.handle(WebResource.java:561)
> at com.sun.jersey.api.client.WebResource.get(WebResource.java:179)
> at
> com
> .taskdock
> .internal.customer.CustomerAction.execute(CustomerAction.java:82)
> at
> com
> .opensymphony
> .xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
> 168)
> at
> com
> .opensymphony
> .xwork
> .interceptor.AroundInterceptor.intercept(AroundInterceptor.java:35)
> at
> com
> .opensymphony
> .xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:
> 165)
>
> I am just trying to get the XML in string form.
>
> I'll be moving on to handler once I get there. It looks like
> MediaType's delegate instance is null and that's causing the issue
> when ClientResponse tries to get the MediaType from valueOf.
>
> Thanks in advance,
> Benjamin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>