On Jul 10, 2009, at 4:06 PM, Jesus M. Rodriguez wrote:
> On Fri, Jul 10, 2009 at 4:54 AM, Paul Sandoz<Paul.Sandoz_at_sun.com>
> wrote:
>>
>> On Jul 9, 2009, at 11:35 PM, Jesus M. Rodriguez wrote:
>>
>>> I've been racking my brain trying to figure out why simple JSON
>>> output
>>> doesn't work for me.
>>> I'm getting this error:
>>>
>>> SEVERE: A message body writer for Java type, class
>>> org.fedoraproject.candlepin.model.User, and MIME media type,
>>> application/json, was not found
>>>
>>
>> What are you dependencies?
>>
>> Please take note of the dependences in the following:
>>
>> https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.1.0-ea/jersey/dependencies.html
>>
>> Goto the JAXB section and take note of the JSON related
>> dependencies that
>> are required.
>
> So the JAXB section states:
>
> 'XML serialization support of Java types that are JAXB beans requires
> a dependency on the JAXB reference implementation version 2.x or
> higher (see later for specific version constraints with respect to
> JSON support). Deploying an application for XML serialization support
> using JAXB with Java SE 6 requires no additional dependences, since
> Java SE 6 ships with JAXB 2.x support.'
>
> I'm using the 1.6.0 openjdk that comes with Fedora. I will try the Sun
> official 1.6 to see if it
> works any differently.
I suspect that will not make any difference. For JSON support you
require additional dependencies as stated in the dependencies document
(see end of email).
Paul.
Maven developers, using JSON serialization support of JAXB beans when
using the MIME media type "application/json" require a dependency on
the jersey-json module (no explicit dependency on jaxb-impl is
required). This module depends on the JAXB reference implementation
version 2.1.10 or greater, and such a version is required when
enabling support for the JAXB natural JSON convention. For all other
supported JSON conventions any JAXB 2.x version may be utilized. The
following dependency needs to be added to the pom:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.1.0-ea</version>
</dependency>
Non-maven developers require:
jackson-asl.jar, jettison.jar, jaxb-impl.jar, jaxb-api.jar,
activation.jar, stax-api.jar
and additionally, if not depending on the jersey-bundle.jar, non-
maven developers require:
jersey-json.jar