hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
191 stars 98 forks source link

How to use jackson for (de-)serialization #101

Closed Sandared closed 9 years ago

Sandared commented 9 years ago

Hi,

I assumed that for using jackson I only have to install the jackson bundles -Jackson-annotations (2.5.4) -Jackson-core (2.5.4) -jackson-databind (2.5.4) -Jackson-JAXRS-base (2.5.4) -Jackson-JAXRS-JSON (2.5.4)

but each tim I try to access a rest endpoint with @Produces(MediaType.APPLICATION_JSON), which returns a simple Object with 2 Strings, i see the following error message:

Jun 17, 2015 4:47:32 PM org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor aroundWriteTo SCHWERWIEGEND: MessageBodyWriter not found for media type=application/json, type=class test.Update, genericType=class test.Update.

Am I missing something?

This is my current setup: ID|State |Level|Name 0|Active | 0|System Bundle (5.0.0) 1|Active | 1|jersey-all (2.17.0) 2|Active | 1|OSGi JAX-RS Connector (4.3.0.201503290743) 3|Active | 1|Jackson-annotations (2.5.4) 4|Active | 1|Jackson-core (2.5.4) 5|Active | 1|jackson-databind (2.5.4) 6|Active | 1|Jackson-JAXRS-base (2.5.4) 7|Active | 1|Jackson-JAXRS-JSON (2.5.4) 8|Active | 1|Jackson-module-JAXB-annotations (2.5.4) 9|Active | 1|Apache Felix Configuration Admin Service (1.8.5.SNAPSHOT) 10|Active | 1|Apache Felix Dependency Manager (4.1.0) 11|Active | 1|Apache Felix Dependency Manager Runtime (4.0.1) 12|Active | 1|Apache Felix Dependency Manager Shell (4.0.2) 13|Active | 1|Apache Felix EventAdmin (1.4.3.SNAPSHOT) 14|Active | 1|Apache Felix Gogo Runtime (0.16.3.SNAPSHOT) 15|Active | 1|Apache Felix Gogo Shell (0.10.0) 16|Active | 1|Apache Felix Http Api (3.0.0.SNAPSHOT) 17|Active | 1|Apache Felix Http Jetty (3.0.3.SNAPSHOT) 18|Active | 1|Apache Felix Servlet API (1.1.1.SNAPSHOT) 19|Active | 1|OPS4J Pax Logging - API (1.7.0) 20|Active | 1|testweb.test (0.0.0.201506171442) 21|Active | 1|osgi.residential (4.3.0.201111022239) 23|Active | 1|Apache Felix Gogo Command (0.14.0)

Best regards, Thomas

Sandared commented 9 years ago

Nevermind :)

Forgot to register JacksonJsonProvider from bundle jackson-jaxrs-json-provider as a service. Everything works fine now. :+1: