You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Nav1771 <na...@yahoo.com> on 2010/06/10 16:26:02 UTC
Camel 2.3.0 , JAXB component marshalling
I have tried various solution given in this forum before posting this issue.
Somehow they dont work with Camel 2.3.0. I would be grateful if someone
could shed some light on how to use the Marshaller.
Caused by: javax.xml.bind.JAXBException: class com.CamelTest.JAXBTestObject
nor any of its super class is known to this context.
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:590)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
at
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
at
org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:110)
at
org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:89)
... 46 more
package com.CamelTest;
import javax.xml.bind.annotation.*;
/**
* Created by IntelliJ IDEA.
* User: navin
* Date: Jun 9, 2010
* Time: 4:27:02 PM
* To change this template use File | Settings | File Templates.
*/
basically the CSVFileParserProcessor returns an annotated object of type
JAXBTestObject
Route :
JaxbDataFormat jaxb = new JaxbDataFormat();
jaxb.setPartClass("com.TestClass.JAXBTestObject");
from("ftp://xyz@192.0.0.1/csvTrackingFiles?password=test&delete=true&delay=5000")
.split(body(String.class).tokenize("\n"))
.convertBodyTo(String.class)
.process(new CSVFileParserProcessor())
.marshal(jaxb)
.to("file://src/test3/");
JAXBTestObject.java:
@XmlRootElement(name="JAXBTestObject")
@XmlAccessorType(XmlAccessType.NONE)
public class JAXBTestObject {
@XmlElement(name="column1")
private String str1;
@XmlElement(name="column2")
private String str2;
@XmlElement(name="column3")
private String str3;
public JAXBTestObject() {
}
public String getStr1() {
return str1;
}
public void setStr1(String str1) {
this.str1 = str1;
}
public String getStr2() {
return str2;
}
public void setStr2(String str2) {
this.str2 = str2;
}
public String getStr3() {
return str3;
}
public void setStr3(String str3) {
this.str3 = str3;
}
}
--
View this message in context: http://old.nabble.com/Camel-2.3.0-%2C--JAXB-component-marshalling-tp28843845p28843845.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel 2.3.0 , JAXB component marshalling
Posted by Nav1771 <na...@yahoo.com>.
Thank you Christian and Claus . You replies fixed it.
I was indeed using 'org.apache.camel.model.dataformat.JaxbDataFormat'
and not the
'org.apache.camel.converter.jaxb.JaxbDataFormat' .
First I put the jaxb.index file in classpath and it worked. After
changing to JAxbDataFormat instance to coverter.jaxb.Jaxbdataformat, it
works without the jaxb.index file.
regards
Christian Mueller wrote:
>
> Hey,
>
> it looks like, you use the
> 'org.apache.camel.model.dataformat.JaxbDataFormat' and not the
> 'org.apache.camel.converter.jaxb.JaxbDataFormat' from camel-jaxb...
>
> Cheers,
> Christian
>
>
--
View this message in context: http://old.nabble.com/Camel-2.3.0-%2C--JAXB-component-marshalling-tp28843845p28855579.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel 2.3.0 , JAXB component marshalling
Posted by Christian Müller <ch...@gmail.com>.
Hey,
it looks like, you use the
'org.apache.camel.model.dataformat.JaxbDataFormat' and not the
'org.apache.camel.converter.jaxb.JaxbDataFormat' from camel-jaxb...
Cheers,
Christian
Re: Camel 2.3.0 , JAXB component marshalling
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You most likely need that jaxb.index file in your JAR.
Just google it and see how to use that.
On Thu, Jun 10, 2010 at 4:26 PM, Nav1771 <na...@yahoo.com> wrote:
>
> I have tried various solution given in this forum before posting this issue.
> Somehow they dont work with Camel 2.3.0. I would be grateful if someone
> could shed some light on how to use the Marshaller.
>
> Caused by: javax.xml.bind.JAXBException: class com.CamelTest.JAXBTestObject
> nor any of its super class is known to this context.
> at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:590)
> at
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:482)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> at
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:75)
> at
> org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:110)
> at
> org.apache.camel.converter.jaxb.JaxbDataFormat.marshal(JaxbDataFormat.java:89)
> ... 46 more
>
>
> package com.CamelTest;
>
> import javax.xml.bind.annotation.*;
>
> /**
> * Created by IntelliJ IDEA.
> * User: navin
> * Date: Jun 9, 2010
> * Time: 4:27:02 PM
> * To change this template use File | Settings | File Templates.
> */
>
> basically the CSVFileParserProcessor returns an annotated object of type
> JAXBTestObject
> Route :
> JaxbDataFormat jaxb = new JaxbDataFormat();
>
> jaxb.setPartClass("com.TestClass.JAXBTestObject");
>
>
>
> from("ftp://xyz@192.0.0.1/csvTrackingFiles?password=test&delete=true&delay=5000")
> .split(body(String.class).tokenize("\n"))
> .convertBodyTo(String.class)
> .process(new CSVFileParserProcessor())
> .marshal(jaxb)
> .to("file://src/test3/");
>
> JAXBTestObject.java:
> @XmlRootElement(name="JAXBTestObject")
> @XmlAccessorType(XmlAccessType.NONE)
> public class JAXBTestObject {
> @XmlElement(name="column1")
> private String str1;
> @XmlElement(name="column2")
> private String str2;
> @XmlElement(name="column3")
> private String str3;
>
> public JAXBTestObject() {
>
> }
>
> public String getStr1() {
> return str1;
> }
>
> public void setStr1(String str1) {
> this.str1 = str1;
> }
>
>
> public String getStr2() {
> return str2;
> }
>
> public void setStr2(String str2) {
> this.str2 = str2;
> }
>
> public String getStr3() {
> return str3;
> }
>
> public void setStr3(String str3) {
> this.str3 = str3;
> }
> }
>
>
>
> --
> View this message in context: http://old.nabble.com/Camel-2.3.0-%2C--JAXB-component-marshalling-tp28843845p28843845.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
--
Claus Ibsen
Apache Camel Committer
Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus