> -----Original Message-----
> From: Sergey Beryozkin [mailto:[email protected]]
> Sent: Monday, November 26, 2012 11:51 AM
> To: [email protected]
> Subject: Re: Suddenly getting "class ... nor any of its super class is
> known to this context" for existing code
> 
> On 26/11/12 19:47, KARR, DAVID wrote:
> >> -----Original Message-----
> >> From: KARR, DAVID
> >> Sent: Monday, November 26, 2012 10:55 AM
> >> To: [email protected]
> >> Subject: Suddenly getting "class ... nor any of its super class is
> >> known to this context" for existing code
> >>
> >> Using CXF 2.5.1.
> >>
> >> I have an existing REST server that had two controllers with a
> handful
> >> of simple GET services.  In the last few days I added a third
> >> controller with a simple service.  I verified that was working, but
> I'm
> >> not sure if I tried the two existing services at the time.
> >>
> >> Today I made some additional minor changes to the third service and
> >> verified it was ok.  I then discovered that one of the original two
> >> services is now failing with an error like this (the other original
> >> service is fine):
> >>
> >> WARNING: javax.xml.bind.JAXBException: class<foo>  nor any of its
> super
> >> class is known to this context.
> >
> > I discovered the need to create a JAXBElementProvider, but this is
> only fixing this for XML responses.  If I make it generate JSON, I
> still get that error.  I have an instance of
> "org.apache.cxf.jaxrs.provider.JSONProvider" specified already.  Is
> there something additional I have to add to it to get it to work with
> JSON?
> I'm assuming you are configuring JAXBElementProvider to treat 'foo' as
> JAXBElement or set some other property which can help the provider
> marshall it ? If yes, then the same property can be most likely set on
> JSONProvider which shares the same common code with JAXBElementProvider

This fixed the problem.  I set both the "extraClass" and "singleJaxbContext" 
properties on the JSONProvider bean.

Reply via email to