Jersey 1->2 Migration, using org.codehaus.jettison packages (MessageBodyWriter not found for media type=application/json)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Jersey 1->2 Migration, using org.codehaus.jettison packages (MessageBodyWriter not found for media type=application/json)

Cates, Tom

 

Updating an OSGi/Spring web application to Jersey 2. Currently things are compiling and installing fine with Jersey 2, but I get this error when our resources are accessed:

MessageBodyWriter not found for media type=application/json, type=class org.codehaus.jettison.json.JSONObject, genericType=class org.codehaus.jettison.json.JSONObject.

Current configuration details for org.codehaus.jettison.json as ‘media provider’ for jersey.

Configuration changes made so far:

• Added dependency on jersey-media-json-jettison

• I’m specifying the org.codehaus package here in web.xml with glassfish specific init-param:

<init-param>

      <param-name>jersey.config.server.provider.packages</param-name>

      <param-value>

                    org.codehaus.jettison.json,

                    ...

      </param-value>

</init-param>

 

 

• Added package to our webapp bundles bnd file:

org.codehaus.jettison.json,\

Which shows it’s successfully importing it in the OSGi console:

Imported packages 

 

org.codehaus.jettison.json; version="1.3.3"

 

Console also shows the package being used by the jersey-media-json-jettison bundle:

packages org.codehaus.jettison.json 

 org.codehaus.jettison.json; version="1.3.3"<org.codehaus.jettison.jettison_1.3.3 [121]> 

    org.glassfish.jersey.media.jersey-media-json-jettison_2.22.1 [192]   

 

Any ideas what's missing here to configure json provider?

Does using org.codehaus.jettison packages require programmatic configuration to work as json provider?

Am I asking the right questions?

 

thank you,

Tom