Hi people,
I'm experiencing a curious problem with Camel JAXB. To make it short:
unmarshalling works correctly, but not marshalling.
I have a route that receives a CxfPayload and unmarshals it to Java. It
works perfectly.
A second route has a processor that emits a Java payload, that must then be
marshaled to XML -> I get the exception below.
Both payloads are in the same package, they are generated using JaxB
generation so they have the correct annotations.
Route 1 (correct) :
from("file:/var/diva/crisis")
.unmarshal("jxb")
.to( "bean:crisisServiceImpl?method=createCrisis" );
Route 2 (incorrect) :
from("direct:sendAck")
.to("log:cr-sendack1")
.marshal("jxb")
.to("log:cr-sendack2")
The exception:
22:42:28,531 | INFO | cr-sendack1 88 |
Exchange[BodyType:eu.diva.tis.api.ws.alert.alarmtypes.AlarmAckMessage,
Body:<ns2:AlarmA ......]
22:42:28,546 | WARN | phase.PhaseInterceptorChain 361 | Application
{http://tis.diva.eu/schemas/crisissvc/1.0}CrisisManagerService#{http://tis.diva.eu/schemas/crisissvc/1.0}TreatCrisis
has thrown exception, unwinding now org.apache.cxf.interceptor.Fault:
Exception occurred during execution on the exchange: Exchange[Message:
eu.diva.tis.api.ws.alert.alarmtypes.alarmackmess...@11ffde3]
at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
at
org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:85)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:60)
.....
Caused by: org.apache.camel.CamelExecutionException: Exception occurred
during execution on the exchange: Exchange[Message:
eu.diva.tis.api.ws.alert.alarmtypes.alarmackmess...@11ffde3]
at
org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1055)
at
org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:445)
at
org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:431)
at
org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeader(DefaultProducerTemplate.java:156)
at
eu.diva.tis.crisis.internal.CrisisServiceImpl.sendAckToEsb(CrisisServiceImpl.java:322)
............
Caused by: javax.xml.bind.JAXBException: Unable to create context
- with linked exception:
[java.lang.NoSuchMethodException:
com.sun.xml.bind.v2.ContextFactory.createContext(java.lang.String,
java.lang.ClassLoader)]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:72)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:77)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:73)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:69)
at
org.apache.camel.converter.jaxb.JaxbDataFormat.createContext(JaxbDataFormat.java:138)
at
org.apache.camel.converter.jaxb.JaxbDataFormat.getContext(JaxbDataFormat.java:103)
at
org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:58)
... 68 more
Caused by: java.lang.NoSuchMethodException:
com.sun.xml.bind.v2.ContextFactory.createContext(java.lang.String,
java.lang.ClassLoader)
at java.lang.Class.getMethod(Class.java:1605)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:69)
... 74 more
I have tried to add com.sun.xml.bind.v2 to the imported packages. It is
resolved correctly :
ka...@root> packages:imports 210 | grep v2
Apache ServiceMix Bundles: jaxb-impl-2.1.12 (90): com.sun.xml.bind.v2;
version=0.0.0
All processing is performed inside the same bundle (a SOAP service is
invoke, which calls a ProducerTemplate to send a message to the "direct"
route depicted above).
If you have the key, please, help me !
--
View this message in context:
http://old.nabble.com/Help-with-Camel-JAXB-%28SMX4-%2B-Camel-2.1.0%29-tp27695115p27695115.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.