Skip to main content

JAXB Marshalling from Jersey in OSGi

No replies
Joined: 2012-06-28

Hi All,

I have Jersey sitting inside Felix OSGi container [I observe the creating of the HTTP Service and then programatically register the Jersey Servlet Container giving it properties that identify my jaxb Application] and all is good with the world.

However :-(

JAXB isn't marshalling my Resource entities (@XmlRootEntity etc) correctly.

Some of the returned Resource instance graph contains objects that do not have classes locatable from the Jersey Servlet Container context (bundle) so JAXB hasn't pre-built a Provider for the class and just complains that the class of the object being marshalled as part of the graph isn't know in the context.

How can I inform Jersey, of the JAXB marshalling objects within it, of the classes it needs to be able to take care of programmatically? I can see it is posible to give it package and class names up front as part of Jersey's initialisation but I need to be able to inform Jersey after it has been initialised that there are new classes it needs to be prepared for.

You help would much appreciated.

- Dean