简体   繁体   中英

java.io.IOException: org.apache.camel.NoTypeConversionAvailableException

I am new to Apache Camel and Blueprint DSL and I am trying to marshal a bean to xml using jaxb but getting the following exception:

java.io.IOException: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: com.test.rqst.InitiateReq to the required type: java.io.InputStream with value com.test.rqst.InitiateReq@681d07ed

My blueprint.xml is as follows

<bean id="testBean2" class="com.test.utility.StopTestDummy" />
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="timerToLog">
  <from uri="timer:foo?period=1000&amp;repeatCount=1"/>
  <bean id="testCastor" ref="testBean2"
              method="setDummyValues" />    
            <marshal>
                <jaxb prettyPrint="true" contextPath="com.scb.s2b.application.pymt.service.payment.stoppymt.rqst"/>
            </marshal>
   <log message="After Marshalling ${body}"/>      
  <to uri="mock:result"/>
</route>    
</camelContext>

The method setDummyValues inside StopTestDummy class is creating the POJO(InitiateReq) as I wanted and returing the same. But I keep getting the error. What am I doing wrong.

Many Thanks.

Not sure this is the issue, but check these out.

First, are you marhsalling the correct class?
Exception says com.test.rqst.InitiateReq , while in your code you tell JAXB to marshal a different package: <jaxb contextPath="com.scb.s2b.application.pymt.service.payment.stoppymt.rqst"/>

Second, did you tell JAXB about InitiateReq class?
Create a file named jaxb.index in the same package and insert the name of the classes you want to marshal/unmarshal (only a line with InitiateReq in your case)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM