You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by wagnermarques <wa...@gmail.com> on 2013/06/01 20:30:11 UTC

unmarshalling with jaxb

Hi camel hiders,

could someone help me to unmarshall this document with jaxb dataformat
please?


<form xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
xmlns:xh="http://www.w3.org/1999/xhtml"  
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:saxon="http://saxon.sf.net/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
xmlns:version="java:org.orbeon.oxf.common.Version"
xmlns:sql="http://orbeon.org/oxf/xml/sql"
xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:exf="http://www.exforms.org/exf/1-0">
    <section-1>
        <control-1>wagnerfrancamarques</control-1>
        <control-3>ads</control-3>
    </section-1>
</form>



I have been trying to do it in this way

*a) in my route I have this:*
        <dataFormats>
    	    <jaxb id="AVALIA_ALUNOJaxb" prettyPrint="true"
contextPath="br.edu.fzlbpms.service.orbeon.jaxb"/>
  	</dataFormats>
        

*b) and in the the package br.edu.fzlbpms.service.orbeon.jaxb I have some
mapped classes*


@XmlRootElement(name="form")
public class AbstrFormData {
	
	@XmlElement(name="section-1")
	AbstrFormData_Section section1;
	
	
	public AbstrFormData_Section getSection1() {
		return section1;
	}

	public void setSection1(AbstrFormData_Section section1) {
		this.section1 = section1;
	}	
}
 


public class AbstrFormData_Section {

	@XmlElement(name="control-1")
	String control1;
	
	@XmlElement(name="control-3")
	String control3;

		
	public String getControl1() {
		return control1;
	}

	public void setControl1(String control1) {
		this.control1 = control1;
	}



	public String getControl3() {
		return control3;
	}

	public void setControl3(String control3) {
		this.control3 = control3;
	}	
}
 				
*
c) this is the excerpt of the exception I am got*
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
content was found starting with element 'dataFormats'. One of
'{"http://camel.apache.org/schema/spring":aop,
"http://camel.apache.org/schema/spring":aggregate,
"http://camel.apache.org/schema/spring":bean,
"http://camel.apache.org/schema/spring":doCatch,
"http://camel.apache.org/schema/spring":when,
"http://camel.apache.org/schema/spring":choice,
"http://camel.apache.org/schema/spring":otherwise,
"http://camel.apache.org/schema/spring":convertBodyTo,
"http://camel.apache.org/schema/spring":delay,
"http://camel.apache.org/schema/spring":dynamicRouter,
"http://camel.apache.org/schema/spring":enrich,
"http://camel.apache.org/schema/spring":filter,
"http://camel.apache.org/schema/spring":doFinally,
"http://camel.apache.org/schema/spring":idempotentConsumer,
"http://camel.apache.org/schema/spring":inOnly,
"http://camel.apache.org/schema/spring":inOut,
"http://camel.apache.org/schema/spring":intercept,
"http://camel.apache.org/schema/spring":interceptFrom,
"http://camel.apache.org/schema/spring":interceptToEndpoint,
"http://camel.apache.org/schema/spring":loadBalance,
"http://camel.apache.org/schema/spring":log,
"http://camel.apache.org/schema/spring":loop,
"http://camel.apache.org/schema/spring":marshal,
"http://camel.apache.org/schema/spring":multicast,
"http://camel.apache.org/schema/spring":onCompletion,
"http://camel.apache.org/schema/spring":onException,
"http://camel.apache.org/schema/spring":pipeline,
"http://camel.apache.org/schema/spring":policy,
"http://camel.apache.org/schema/spring":pollEnrich,
"http://camel.apache.org/schema/spring":process,
"http://camel.apache.org/schema/spring":recipientList,
"http://camel.apache.org/schema/spring":removeHeader,
"http://camel.apache.org/schema/spring":removeHeaders,
"http://camel.apache.org/schema/spring":removeProperty,
"http://camel.apache.org/schema/spring":resequence,
"http://camel.apache.org/schema/spring":rollback,
"http://camel.apache.org/schema/spring":route,
"http://camel.apache.org/schema/spring":routingSlip,
"http://camel.apache.org/schema/spring":sample,
"http://camel.apache.org/schema/spring":setBody,
"http://camel.apache.org/schema/spring":setExchangePattern,
"http://camel.apache.org/schema/spring":setFaultBody,
"http://camel.apache.org/schema/spring":setHeader,
"http://camel.apache.org/schema/spring":setOutHeader,
"http://camel.apache.org/schema/spring":setProperty,
"http://camel.apache.org/schema/spring":sort,
"http://camel.apache.org/schema/spring":split,
"http://camel.apache.org/schema/spring":stop,
"http://camel.apache.org/schema/spring":threads,
"http://camel.apache.org/schema/spring":throttle,
"http://camel.apache.org/schema/spring":throwException,
"http://camel.apache.org/schema/spring":to,
"http://camel.apache.org/schema/spring":transacted,
"http://camel.apache.org/schema/spring":transform,
"http://camel.apache.org/schema/spring":doTry,
"http://camel.apache.org/schema/spring":unmarshal,
"http://camel.apache.org/schema/spring":validate,
"http://camel.apache.org/schema/spring":wireTap}' is expected.
	at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)[:]
	at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
	at
org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
Source)[:]
	at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
Source)[:]
	at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
Source)[:]
	at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
Source)[:]
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)[:]
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)[:]
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)[:]
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
	at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
	at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)[:]
	at
org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[69:org.springframework.beans:3.0.7.RELEASE]
	at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[69:org.springframework.beans:3.0.7.RELEASE]
	... 18 more



thanks, best regards







--
View this message in context: http://camel.465427.n5.nabble.com/unmarshalling-with-jaxb-tp5733598.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: unmarshalling with jaxb

Posted by wagnermarques <wa...@gmail.com>.
I will study it, thanks for be kind



--
View this message in context: http://camel.465427.n5.nabble.com/unmarshalling-with-jaxb-tp5733598p5733743.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: unmarshalling with jaxb

Posted by Claus Ibsen <cl...@gmail.com>.
Yes you need jaxb.index file. Google the internet to learn more about
this file and why its needed.

On Sun, Jun 2, 2013 at 9:33 PM, wagnermarques <wa...@gmail.com> wrote:
> Thanks Claus, I can not guilt eclipse, was my fault...
>
> But now I am getting this exception:
>
> 14:33:56,993 | ERROR | xtenderThread-10 | ContextLoaderListener            |
> 80 - org.springframework.osgi.extender - 1.2.1 | Application context refresh
> failed (OsgiBundleXmlApplicationContext(bundle=fzlbpms-service-orbeon,
> config=osgibundle:/META-INF/spring/*.xml))
> org.apache.camel.RuntimeCamelException: javax.xml.bind.JAXBException:
> "br.edu.fzlbpms.service.orbeon.jaxb" doesnt contain ObjectFactory.class or
> jaxb.index
> (...)
>
> I need to create this file?
>
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/unmarshalling-with-jaxb-tp5733598p5733629.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: unmarshalling with jaxb

Posted by wagnermarques <wa...@gmail.com>.
Thanks Claus, I can not guilt eclipse, was my fault...

But now I am getting this exception:

14:33:56,993 | ERROR | xtenderThread-10 | ContextLoaderListener            |
80 - org.springframework.osgi.extender - 1.2.1 | Application context refresh
failed (OsgiBundleXmlApplicationContext(bundle=fzlbpms-service-orbeon,
config=osgibundle:/META-INF/spring/*.xml))
org.apache.camel.RuntimeCamelException: javax.xml.bind.JAXBException:
"br.edu.fzlbpms.service.orbeon.jaxb" doesnt contain ObjectFactory.class or
jaxb.index
(...)

I need to create this file?  








--
View this message in context: http://camel.465427.n5.nabble.com/unmarshalling-with-jaxb-tp5733598p5733629.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: unmarshalling with jaxb

Posted by Claus Ibsen <cl...@gmail.com>.
The XML file where you have <camelContext> is wrong. The elements
should have a specific order so you may need to move <dataFormats> up
or down a bit.

Any decent Java editor today can do XSD schema validation of an XML
file so you can do that, and it can assist you.

Otherwise you can find the XSD online at
http://camel.apache.org/schema/spring/

And look at the file and see the order etc.

On Sat, Jun 1, 2013 at 8:30 PM, wagnermarques <wa...@gmail.com> wrote:
> Hi camel hiders,
>
> could someone help me to unmarshall this document with jaxb dataformat
> please?
>
>
> <form xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
> xmlns:xh="http://www.w3.org/1999/xhtml"
> xmlns:ev="http://www.w3.org/2001/xml-events"
> xmlns:xi="http://www.w3.org/2001/XInclude"
> xmlns:saxon="http://saxon.sf.net/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
> xmlns:xbl="http://www.w3.org/ns/xbl"
> xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
> xmlns:version="java:org.orbeon.oxf.common.Version"
> xmlns:sql="http://orbeon.org/oxf/xml/sql"
> xmlns:p="http://www.orbeon.com/oxf/pipeline"
> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xf="http://www.w3.org/2002/xforms"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:exf="http://www.exforms.org/exf/1-0">
>     <section-1>
>         <control-1>wagnerfrancamarques</control-1>
>         <control-3>ads</control-3>
>     </section-1>
> </form>
>
>
>
> I have been trying to do it in this way
>
> *a) in my route I have this:*
>         <dataFormats>
>             <jaxb id="AVALIA_ALUNOJaxb" prettyPrint="true"
> contextPath="br.edu.fzlbpms.service.orbeon.jaxb"/>
>         </dataFormats>
>
>
> *b) and in the the package br.edu.fzlbpms.service.orbeon.jaxb I have some
> mapped classes*
>
>
> @XmlRootElement(name="form")
> public class AbstrFormData {
>
>         @XmlElement(name="section-1")
>         AbstrFormData_Section section1;
>
>
>         public AbstrFormData_Section getSection1() {
>                 return section1;
>         }
>
>         public void setSection1(AbstrFormData_Section section1) {
>                 this.section1 = section1;
>         }
> }
>
>
>
> public class AbstrFormData_Section {
>
>         @XmlElement(name="control-1")
>         String control1;
>
>         @XmlElement(name="control-3")
>         String control3;
>
>
>         public String getControl1() {
>                 return control1;
>         }
>
>         public void setControl1(String control1) {
>                 this.control1 = control1;
>         }
>
>
>
>         public String getControl3() {
>                 return control3;
>         }
>
>         public void setControl3(String control3) {
>                 this.control3 = control3;
>         }
> }
>
> *
> c) this is the excerpt of the exception I am got*
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid
> content was found starting with element 'dataFormats'. One of
> '{"http://camel.apache.org/schema/spring":aop,
> "http://camel.apache.org/schema/spring":aggregate,
> "http://camel.apache.org/schema/spring":bean,
> "http://camel.apache.org/schema/spring":doCatch,
> "http://camel.apache.org/schema/spring":when,
> "http://camel.apache.org/schema/spring":choice,
> "http://camel.apache.org/schema/spring":otherwise,
> "http://camel.apache.org/schema/spring":convertBodyTo,
> "http://camel.apache.org/schema/spring":delay,
> "http://camel.apache.org/schema/spring":dynamicRouter,
> "http://camel.apache.org/schema/spring":enrich,
> "http://camel.apache.org/schema/spring":filter,
> "http://camel.apache.org/schema/spring":doFinally,
> "http://camel.apache.org/schema/spring":idempotentConsumer,
> "http://camel.apache.org/schema/spring":inOnly,
> "http://camel.apache.org/schema/spring":inOut,
> "http://camel.apache.org/schema/spring":intercept,
> "http://camel.apache.org/schema/spring":interceptFrom,
> "http://camel.apache.org/schema/spring":interceptToEndpoint,
> "http://camel.apache.org/schema/spring":loadBalance,
> "http://camel.apache.org/schema/spring":log,
> "http://camel.apache.org/schema/spring":loop,
> "http://camel.apache.org/schema/spring":marshal,
> "http://camel.apache.org/schema/spring":multicast,
> "http://camel.apache.org/schema/spring":onCompletion,
> "http://camel.apache.org/schema/spring":onException,
> "http://camel.apache.org/schema/spring":pipeline,
> "http://camel.apache.org/schema/spring":policy,
> "http://camel.apache.org/schema/spring":pollEnrich,
> "http://camel.apache.org/schema/spring":process,
> "http://camel.apache.org/schema/spring":recipientList,
> "http://camel.apache.org/schema/spring":removeHeader,
> "http://camel.apache.org/schema/spring":removeHeaders,
> "http://camel.apache.org/schema/spring":removeProperty,
> "http://camel.apache.org/schema/spring":resequence,
> "http://camel.apache.org/schema/spring":rollback,
> "http://camel.apache.org/schema/spring":route,
> "http://camel.apache.org/schema/spring":routingSlip,
> "http://camel.apache.org/schema/spring":sample,
> "http://camel.apache.org/schema/spring":setBody,
> "http://camel.apache.org/schema/spring":setExchangePattern,
> "http://camel.apache.org/schema/spring":setFaultBody,
> "http://camel.apache.org/schema/spring":setHeader,
> "http://camel.apache.org/schema/spring":setOutHeader,
> "http://camel.apache.org/schema/spring":setProperty,
> "http://camel.apache.org/schema/spring":sort,
> "http://camel.apache.org/schema/spring":split,
> "http://camel.apache.org/schema/spring":stop,
> "http://camel.apache.org/schema/spring":threads,
> "http://camel.apache.org/schema/spring":throttle,
> "http://camel.apache.org/schema/spring":throwException,
> "http://camel.apache.org/schema/spring":to,
> "http://camel.apache.org/schema/spring":transacted,
> "http://camel.apache.org/schema/spring":transform,
> "http://camel.apache.org/schema/spring":doTry,
> "http://camel.apache.org/schema/spring":unmarshal,
> "http://camel.apache.org/schema/spring":validate,
> "http://camel.apache.org/schema/spring":wireTap}' is expected.
>         at
> org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> Source)[:]
>         at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)[:]
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
>         at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)[:]
>         at
> org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown
> Source)[:]
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown
> Source)[:]
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown
> Source)[:]
>         at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown
> Source)[:]
>         at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> Source)[:]
>         at
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> Source)[:]
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)[:]
>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)[:]
>         at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)[:]
>         at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)[:]
>         at
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)[69:org.springframework.beans:3.0.7.RELEASE]
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)[69:org.springframework.beans:3.0.7.RELEASE]
>         ... 18 more
>
>
>
> thanks, best regards
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/unmarshalling-with-jaxb-tp5733598.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen