users@jersey.java.net

Client Help

From: Scott Glass <remedygeek_at_msn.com>
Date: Tue, 8 Jun 2010 15:58:53 -0400

I've written a small program to call a REST Web Service written in Jersey.
The service works, and responds with a JSONObject as expected.

But the client keeps throwing warnings and exceptions.

 

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

Jun 8, 2010 3:56:28 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.

 

com.sun.jersey.api.client.ClientHandlerException:
java.lang.NullPointerException

        at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLCon
nectionClientHandler.java:128)

        at com.sun.jersey.api.client.Client.handle(Client.java:551)

        at
com.sun.jersey.api.client.WebResource.handle(WebResource.java:556)

        at
com.sun.jersey.api.client.WebResource.access$200(WebResource.java:69)

        at
com.sun.jersey.api.client.WebResource$Builder.get(WebResource.java:451)

        at
com.sungard.cto.arsystem.plugin.SunGardUpdateService.createEntry(SunGardUpda
teService.java:199)

        at com.bmc.arsys.pluginsvr.plugins.a.ArdbcCreate(Unknown Source)

        at com.bmc.arsys.pluginsvr.a.ArEsArdbcCreate_4(Unknown Source)

        at
com.bmc.arsys.arrpc.ARPluginServerDispatcher.dispatchOncRpcCall(Unknown
Source)

        at
org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport.dispatchCall(Unkn
own Source)

        at com.bmc.arsys.pluginsvr.a.d.dispatchCall(Unknown Source)

        at
org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport._listen(Unknown
Source)

        at
org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport.access$000(Unknow
n Source)

        at
org.acplt.oncrpc.server.OncRpcTcpConnectionServerTransport$1.run(Unknown
Source)

Caused by: java.lang.NullPointerException

        at javax.ws.rs.core.MediaType.toString(MediaType.java:265)

        at
com.sun.jersey.api.client.ClientRequest.getHeaderValue(ClientRequest.java:22
3)

        at
com.sun.jersey.api.client.TerminatingClientHandler.headerValueToString(Termi
natingClientHandler.java:229)

        at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.writeOutBound
Headers(URLConnectionClientHandler.java:227)

        at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLCo
nnectionClientHandler.java:172)

        at
com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLCon
nectionClientHandler.java:126)

        ... 13 more

 

Here's the code for the client.

 

           ClientConfig config = new DefaultClientConfig();

 

            myClient = Client.create(config);

 

          WebResource resource =
myClient.resource("http://portal-dev2.sgns.net:8181/Case/create");

 

         MultivaluedMap map = new MultivaluedMapImpl();

 

         map.add("Format", "json");

         map.add("IncidentID", " HD0000001042502");

         map.add("CreateDate", " 2009-07-01 16:47");

 

       resource = resource.queryParams(map);

 

      /* resource.getURI().toString() returns
http://portal-dev2.sgns.net:8181/Case/create?IncidentID=HD0000001042502
<http://portal-dev2.sgns.net:8181/Case/create?IncidentID=HD0000001042502&For
mat=json&CreateDate=2009-07-01+16:47>
&Format=json&CreateDate=2009-07-01+16:47 which works.*/

 

   /* Line 199 */

    Object object =
resource.accept(MediaType.APPLICATION_JSON_TYPE).get(ClientResponse.class);

 

Can anyone please shed some light as to what's causing this? I've read
pretty much everything I can get my hands on, but I'm at a loss.

 

Thanks,

Scott