Hi
I am using RestTemplate and JAXB as a message converter. (org.springframework.oxm.jaxb.Jaxb2Marshaller)
I am calling:
As a result I get a ClassCastException telling that I try to cast JAXBElement to API.Code:// I have a POJO named API which is generated by xjc from a xsd // RHEVM_API is a URL API api = restTemplate.getForObject(RHEVM_API, API.class);
After a debug session I understood that the 'getForObject' call return a JAXBElement which contains the API POJO inside. Calling the getValue() method of this JAXBelement return the API POJO.
Looking at RestTemplate examples I see that no one has to do this 'trick'.Code:JAXBElement<?> jaxbElement = restTemplate.getForObject(RHEVM_API, JAXBElement.class); return (API)jaxbElement.getValue();
I know I am missing something here :-(
What is it?
Thanks
Avishay


Reply With Quote
