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.


Reply via email to