users@glassfish.java.net

glassfish 3.1 with jersey 1.5 (out of the box) client issues

From: <forums_at_java.net>
Date: Thu, 21 Apr 2011 09:43:52 -0500 (CDT)

Hi, I have a glassfish 3.1 isntall using jersey 1.5 (which came with it). My
server is hosting a variety of REST web services for Java SDK clients,
packaged with jar files.  In the past, the clients were packaged with:
[list] [*]jerset-gf-bundle.jar [*]jettison.jar [*]jsr311-api.jar [/list] Now,
I've found that: [list] [*] jersey-client.jar [*] jersey-core.jar [*]
jettison.jar [/list] achieve compile time success with Glassfish 3.1 and
jersey 1.5 for a client. However, when a client attempt to contact the server
via a REST web service, they receive very interesting errors; which I'm
having quite a bit of trouble figuring out. Here is one example. Most errors
follow this pattern.

SEVERE: A message body reader for Java class
org.codehaus.jettison.json.JSONArray, and Java type class
org.codehaus.jettison.json.JSONArray, and MIME media type appliaction/json
was not found .... com.sun.jersey.api.client.ClientResponse getEntity SEVERE:
The registered message body readers compatible with the MIME media type are:
*/* -> com.sun.jersey.core.impl.provider.entity.FormProvider (followed by
other com.sun.jersey.core.impl.provider.entity.* classes) Exception in thread
"Thread-27" com.sun.jersey.api.clientHandlerException: A message body reader
for Java class org.codehaus.jettison.json.JSONArray, and Java type
org.codehaus.jettison.json.JSONArray, and MIME media type application/json
was not found at
com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:548)
at
com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:505)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:605) at
com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) .....
Basically, this software worked in Glassfish 3.01 with the pre-loaded version
of Jersey that shipped with it in the cofinguration described above. I'm
curious if I need to "do-something-special" to make this work ? Is it
expected that the client needs to use more libraries/jar files than what I
have mentioned? Am I expected to package the war file in a more elaborate
manner? Or add special items to it? Thanks for any advice.


--
[Message sent by forum member 'hoffman462']
View Post: http://forums.java.net/node/794091