Hi,TheWinch: I am using JAXB in osgi too, it seems I haven't encounter such a problem; But I really want know what's exactly problem you have. And could you help me to send you project to my private mail, if you don't mind? If you cannot sent , could you help me to tell some details:
Is the generated JAXB Object in a separate bundle? Or generated JAXB object exists in the same bundle of camel route? If the generated JAXB Object in a separate bundle, how do you import the jaxb object's class? Using "import-package" or "Require-Package"? It seems the JAXB Class can be find, but JAXB.index cannot be find, in you test. If you are using "Require-Package" ... Felix has a bug for Require-Package, it will cause some class or resource searching failed, until 3.0.2 solved it, so if you are using SMX, you must update to Apache Karaf 2.1.0(it bundled the felix framework 3.0.2 inside) But if you are using "Import-Package", I am not sure why now; Thanks a lot; -----Original----- Sender: TheWinch [mailto:vincent.girardrey...@thalesgroup.com] Date: 2010/2/23 5:49 Receiver: users@camel.apache.org Subject: Help with Camel JAXB (SMX4 + Camel 2.1.0) 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.d iva.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.j ava:155) at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMet hodInvoker.java:85) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:1 21) 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:4 45) at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProdu cerTemplate.java:431) at org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeader(DefaultProdu cerTemplate.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.jav a:103) at org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:5 8) ... 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-tp2769 5115p27695115.html Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.