Hello Sergey, I've updated from CXF 2.5.1 to 2.6.1.
We are using our own JAXBElementProvider, which extends from JAXBElementProvider in order to add a xml-stylesheet to the top of the returned XML. I had to change the code from: MyJAXBElementProvider extends JAXBElementProvider To: MyJAXBElementProvider extends JAXBElementProvider<Object> Otherwise the code could not compile because of the overridden method setMarshallerProperties. Maybe it has something to do with this? I doubt that. I was performing a manual un-/marshalling of this kind of class and it worked. I have no idea what is wrong here. Both JAXBContext instances have the same output for toString(). Best regards, Marko Voß ePublishing & eScience Development & Applied Research Phone +49 7247 808-744 Fax +49 7247 808-133 [email protected] FIZ Karlsruhe - Leibniz Institute for Information Infrastructure Hermann-von-Helmholtz-Platz 1 76344 Eggenstein-Leopoldshafen, Germany www.fiz-karlsruhe.de -----Original Message----- From: Sergey Beryozkin [mailto:[email protected]] Sent: Thursday, June 14, 2012 2:01 PM To: [email protected] Cc: Voß, Marko Subject: Re: JAXBElementProvider not able to deal with specific type of classes? Hi Marko On 14/06/12 12:29, Voß, Marko wrote: > Hello, > > (CXF v2.6.1) > > We have, say, a JAX-RS interface like this one: > > --- > @Path("/foo") > public interface Foo { > > @Path("/bar") > @POST > @Consumes(MediaType.TEXT_XML) > @Produces(MediaType.TEXT_XML) > JAXBElement<BarTypeTO> doSomething(FooTO); } > --- > > FooTO is a class of the following structure (generated by JAXB-Maven-Plugin): > > --- > public class FooTO extends JAXBElement<ExampleTypeTO> { > > protected final static Qname NAME = new Qname("namespace", "foo"); > > public FooTO(ExampleTypeTO value) { > super(NAME, ((Class) ExampleTypeTO.class), null, value); > } > > public FooTO() { > super(NAME, ((Class) ExampleTypeTO.class), null, null); > } > } > --- > > ExampleTypeTO represents a schema complexType. Schema: > > --- > <xs:element name="foo" type="exampleType"/> > > <xs:complexType name"exampleType">...</xs:complexType> > --- > > Now, when performing a request to the endpoint from above, I get the > following exception: > > JAXBException: FooTO is not known to this context. > > I debugged JAXBElementProvider and the JAXBContext instance knows all classes > from the package of FooTO except FooTO itself and of course the > ObjectFactory, which may be correct but why is JAXB not able to unmarshal > FooTO? This was working once. > > Is there something wrong at line 173-175 in JAXBElementProvider? > I do not actually remember changing anything that may've affected the processing of classes like FooTO which extend JAXBElement. When did it work last time ? May be it is to do with the JAXB impl versions ? Thanks, Sergey > > Best regards, > Marko > > > ------------------------------------------------------- > > Fachinformationszentrum Karlsruhe, Gesellschaft für > wissenschaftlich-technische Information mbH. > Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB > 101892. > Geschäftsführerin: Sabine Brünger-Weilandt. > Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner. > > ------------------------------------------------------- Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische Information mbH. Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 101892. Geschäftsführerin: Sabine Brünger-Weilandt. Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.
