users@jersey.java.net

Re: [Jersey] problems marshaling xml

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 15 Apr 2009 10:23:08 +0200

On Apr 14, 2009, at 6:04 PM, Felipe Gaścho wrote:

> I have a strange situation here.. I created the types of my project
> and I am able to use it through the Jersey resources.. everything
> works fine..
>
> But I can't marshal and unmarshal the same types with plain JAXB :(
>

How are you creating JAXBContext ?


> I am curious about what jersey uses automagically to convert objects
> in XML and also to find out what I am missing in my test
> cases..........
>


If you have not defined an implementation ContextResolver<JAXBContext>
to return an instance of JAXBContext for your JAXB types then Jersey
will create a JAXBContext from the class to marshall or unmarshall,
for example:

   Class c = ...
   JAXBContext jc = JAXBContext.newInstance(c);

Paul.