You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Clifton Eaton (JIRA)" <ji...@apache.org> on 2011/04/14 19:57:05 UTC

[jira] [Created] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
---------------------------------------------------------------------------------------------------------------------

                 Key: CAMEL-3865
                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
             Project: Camel
          Issue Type: Bug
          Components: camel-jaxb
    Affects Versions: 2.7.0
            Reporter: Clifton Eaton


FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  

FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:

Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
	... 39 more
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
	... 47 more
Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
	... 51 more
Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
	... 57 more
 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062698#comment-13062698 ] 

Claus Ibsen commented on CAMEL-3865:
------------------------------------

Willem whats the status of this? Seems like the end user should use that partClass stuff in the dataformat

> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>            Assignee: Willem Jiang
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Issue Comment Edited] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020210#comment-13020210 ] 

Willem Jiang edited comment on CAMEL-3865 at 4/15/11 7:50 AM:
--------------------------------------------------------------

Hi,

The FallbackTypeConverter just create a JAXB context based on the type class that is annotated with @XmlRootElement,the jaxb context doesn't has all the packages class, but JAXB will add all the types thats relates to this types class.
I just committed [a small unit test|http://svn.apache.org/viewvc?rev=1092615&view=rev] to reproducer the error, but I had no luck with it. Maybe you can consider to add some annotation to work around this issue.

If you want to camel marshal and unmarshal the data rightly, you can use JAXB data format directly, and you can set up other JAXB context options that you want.
Here is the example:
{code}
      <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:marshal"/>
            <marshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.PurchaseOrder"
                    partNamespace="{http://example.camel.org/apache}po" />
            </marshal>
            <to uri="mock:marshal"/>
        </route>
        <route>
            <from uri="direct:unmarshal"/>
            <unmarshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.Partial" />
            </unmarshal>
            <to uri="mock:unmarshal"/>
        </route>
    </camelContext> 
{code}

      was (Author: njiang):
    Hi,

The FallbackTypeConverter just create a JAXB context based on the type class that is annotated with @XmlRootElement,the jaxb context doesn't has all the packages class, but JAXB will add all the types thats relates to this types class.
I just committed [a small unit test|http://svn.apache.org/viewvc?rev=1092615&view=rev
] to reproducer the error, but I had no luck with it. Maybe you can consider to add some annotation to work around this issue.

If you want to camel marshal and unmarshal the data rightly, you can use JAXB data format directly, and you can set up other JAXB context options that you want.
Here is the example:
{code}
      <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:marshal"/>
            <marshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.PurchaseOrder"
                    partNamespace="{http://example.camel.org/apache}po" />
            </marshal>
            <to uri="mock:marshal"/>
        </route>
        <route>
            <from uri="direct:unmarshal"/>
            <unmarshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.Partial" />
            </unmarshal>
            <to uri="mock:unmarshal"/>
        </route>
    </camelContext> 
{code}
  
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020210#comment-13020210 ] 

Willem Jiang commented on CAMEL-3865:
-------------------------------------

Hi,

The FallbackTypeConverter just create a JAXB context based on the type class that is annotated with @XmlRootElement, it's just a fall back.
If you want to camel marshal and unmarshal the data rightly, you can use JAXB data format directly, and you can set up other JAXB context options that you want.
Here is the example:
{code}
      <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:marshal"/>
            <marshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.PurchaseOrder"
                    partNamespace="{http://example.camel.org/apache}po" />
            </marshal>
            <to uri="mock:marshal"/>
        </route>
        <route>
            <from uri="direct:unmarshal"/>
            <unmarshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.Partial" />
            </unmarshal>
            <to uri="mock:unmarshal"/>
        </route>
    </camelContext> 
{code}

> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Issue Comment Edited] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13020210#comment-13020210 ] 

Willem Jiang edited comment on CAMEL-3865 at 4/15/11 7:50 AM:
--------------------------------------------------------------

Hi,

The FallbackTypeConverter just create a JAXB context based on the type class that is annotated with @XmlRootElement,the jaxb context doesn't has all the packages class, but JAXB will add all the types thats relates to this types class.
I just committed [a small unit test|http://svn.apache.org/viewvc?rev=1092615&view=rev
] to reproducer the error, but I had no luck with it. Maybe you can consider to add some annotation to work around this issue.

If you want to camel marshal and unmarshal the data rightly, you can use JAXB data format directly, and you can set up other JAXB context options that you want.
Here is the example:
{code}
      <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:marshal"/>
            <marshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.PurchaseOrder"
                    partNamespace="{http://example.camel.org/apache}po" />
            </marshal>
            <to uri="mock:marshal"/>
        </route>
        <route>
            <from uri="direct:unmarshal"/>
            <unmarshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.Partial" />
            </unmarshal>
            <to uri="mock:unmarshal"/>
        </route>
    </camelContext> 
{code}

      was (Author: njiang):
    Hi,

The FallbackTypeConverter just create a JAXB context based on the type class that is annotated with @XmlRootElement, it's just a fall back.
If you want to camel marshal and unmarshal the data rightly, you can use JAXB data format directly, and you can set up other JAXB context options that you want.
Here is the example:
{code}
      <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:marshal"/>
            <marshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.PurchaseOrder"
                    partNamespace="{http://example.camel.org/apache}po" />
            </marshal>
            <to uri="mock:marshal"/>
        </route>
        <route>
            <from uri="direct:unmarshal"/>
            <unmarshal>
                <jaxb prettyPrint="false" contextPath="org.apache.camel.example"
                    partClass="org.apache.camel.example.Partial" />
            </unmarshal>
            <to uri="mock:unmarshal"/>
        </route>
    </camelContext> 
{code}
  
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang resolved CAMEL-3865.
---------------------------------

    Resolution: Cannot Reproduce

> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>            Assignee: Willem Jiang
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13019999#comment-13019999 ] 

Claus Ibsen commented on CAMEL-3865:
------------------------------------

Can you provide an unit test which reproduces this?

> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13062897#comment-13062897 ] 

Willem Jiang commented on CAMEL-3865:
-------------------------------------


The user never send any other comments on the JIRA, I did some test on the annotated classes with jaxb.index.
It looks like the camel-jaxb can pick up the CamelContext rightly from the class rightly.

So I close this issue with can not reproduce. 

> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>            Assignee: Willem Jiang
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (CAMEL-3865) FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Willem Jiang reassigned CAMEL-3865:
-----------------------------------

    Assignee: Willem Jiang

> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes
> ---------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-3865
>                 URL: https://issues.apache.org/jira/browse/CAMEL-3865
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-jaxb
>    Affects Versions: 2.7.0
>            Reporter: Clifton Eaton
>            Assignee: Willem Jiang
>
> FallbackTypeConverter method throws JAXBException when marshalling nested, non-ObjectFactory, JAXB annotated, classes. These are  classes that are annotated with the @XmlRootElement, but not generated using XJC, so there is no ObjectFactory class for them.  The intention is to provide the package names containing the jaxb.index files to build the context.  
> FallbackTypeConverter does not marshal or unmarshal using the package names, but rather uses the value's Class as the context.  Thus everytime a JAXB annotated object contains another JAXB annotated object, there is an exception that looks like this:
> Caused by: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: com.foo.bar.MyObject@15e6463]
> 	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1155)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:93)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.doConvertTo(BaseTypeConverterRegistry.java:190)
> 	at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:101)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:73)
> 	at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:115)
> 	at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:103)
> 	at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:74)
> 	at org.apache.camel.language.bean.BeanExpression$InvokeProcessor.process(BeanExpression.java:136)
> 	... 39 more
> Caused by: javax.xml.bind.MarshalException
>  - with linked exception:
> [javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:96)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.marshall(FallbackTypeConverter.java:174)
> 	at org.apache.camel.converter.jaxb.FallbackTypeConverter.convertTo(FallbackTypeConverter.java:88)
> 	... 47 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.property.SingleMapNodeProperty.serializeBody(SingleMapNodeProperty.java:272)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
> 	at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:324)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 51 more
> Caused by: javax.xml.bind.JAXBException: class com.foo.bar.nested.MyNested nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:594)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 57 more
>  

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira