JAXB DataFormat supports to set the JaxbContext.
Please try these code,
JaxbDataFormat jaxb = new JaxbDataFormat();
jaxb.setContext(JAXBContext.newInstance(EndpointInformation.class));
Willem
Frank C. wrote:
> Willem and Ade:
>
> What worked is trimming the string to "org.helios.routing.server" as well as
> adding the jaxb.index to the org.helios.routing.server.
>
> While it works, I don't have the need to do so much work (the types are all
> @Xml annotated) when using JAXB directly. e.g:
>
> EndpointInformation epI = (EndpointInformation)
>
> JAXBContext.newInstance(EndpointInformation.class)
> .createUnmarshaller()
>
> .unmarshal(request.getInputStream());
>
> JAXBContext.newInstance(EndpointInformation.class)
> .createMarshaller().marshal(epI,
> response.getOutputStream());
>
> works fine. Any thoughts? Perhaps JaxbDataFormat should take a class name
> constructor and set/get?
>
> None the less, thanks for the help
>
> Frank
>
>
>
> willem.jiang wrote:
>> Is there an ObjectFactory or a jaxb.index file in the package of
>> org.helios.routing.server.EndpointInformation ?
>> Can you double check it ?
>>
>> If not , JAXB can't do the marshal and unmarshal work for you.
>>
>> Willem
>>
>> Frank C. wrote:
>>> I am getting a "Caused by: javax.xml.bind.JAXBException:
>>> "org.helios.routing.server.EndpointInformation" doesnt contain
>>> ObjectFactory.class or jaxb.index" exception when attempting to execute
>>> the
>>> following route:
>>>
>>> public void configure() throws Exception {
>>> from("direct:ping")
>>> .marshal(jaxb)
>>> .to(endpointInformation.getEpUrl())
>>> .unmarshal(jaxb)
>>> .to("browse:pingEnd");
>>> }
>>>
>>> where
>>> jaxb = new JaxbDataFormat();
>>> jaxb.setContextPath(targetClassName);
>>>
>>> and targetClassName = "org.helios.routing.server.EndpointInformation"
>>>
>>> I am using Camel 2.0-M1
>>>
>>>
>>>
>>
>>
>