Hello dresden! (Sounds lucky for me, because I was born in Dresden... :o) )
Claus has explained this in his book Camel in action ( http://www.manning.com/ibsen/). I think you need a copy... :-) The source code is available at google code and I think you should follow the following links: http://code.google.com/p/camelinaction/source/browse/trunk/chapter3/order/src/test/java/camelinaction/PurchaseOrderJaxbTest.java http://code.google.com/p/camelinaction/source/browse/trunk/chapter3/order/src/test/resources/camelinaction/order-jaxb.xml http://code.google.com/p/camelinaction/source/browse/trunk/chapter3/order/src/test/resources/camelinaction/jaxb.index I think you have forgotten the jaxb.index file. Alternative, you can use the ObjectFactory class (which is generated by the JAXB xjc). Hope this will help, Christian On Fri, Sep 10, 2010 at 7:05 PM, dresden <[email protected]> wrote: > > Hello, > I am using maven and this are the dependencies: > > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-spring</artifactId> > <version>2.4.0</version> > </dependency> > > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-jms</artifactId> > <version>2.4.0</version> > </dependency> > > <dependency> > <groupId>org.apache.camel</groupId> > <artifactId>camel-jaxb</artifactId> > <version>2.4.0</version> > </dependency> > > I am still getting this error. Maybe I am missing something on how Jaxb is > supposed to work for Camel. > > This is my route (verbatim) > > <route> > <from uri="amq:queue:event.x" /> > <unmarshal> > <jaxb prettyPrint="true" > contextPath="test.integration.dto" /> > </unmarshal> > <marshal> > <jaxb prettyPrint="true" > contextPath="test.integration.dto" /> > </marshal> > <to uri="amq:queue:event.y" /> > </route> > > This is the my class that I want to marshall, unmarshall: > > package test.integration.dto; > > import java.io.Serializable; > > import javax.xml.bind.annotation.XmlRootElement; > > @XmlRootElement > public class Event implements Serializable { > String type; > String user; > String system; > > public String getType() { > return type; > } > public void setType(String type) { > this.type = type; > } > public String getUser() { > return user; > } > public void setUser(String user) { > this.user = user; > } > public String getSystem() { > return system; > } > public void setSystem(String system) { > this.system = system; > } > } > > That is all the config I have done. Does anyone see any problems with that? > I send a JMS message to event.x > > <Event/> > > is the content of the JMS message. I am hoping that it will unmarshall that > into an Event pojo (above, annotated). Then marshal it back into xml. I > still get the DataFormat error: > > Caused by: java.io.IOException: "test.integration.dto" doesnt contain > ObjectFactory.class or jaxb.index > > Thanks for all the responses! > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/JAXB-Unmarshalling-DataFormat-error-suggestions-tp2814620p2835310.html > Sent from the Camel - Users mailing list archive at Nabble.com. >
