cxf - Camel bean binding tries to convert the body to Exchange -
i have simple route looks this:
<route handlefault="true" streamcache="true" id="routea"> <from uri="cxfrs://bean://simplecxf" /> <log message="the message body contains ${body}"/> <to uri="direct-vm:routeb" /> </route> <route handlefault="true" streamcache="true" id="routeb"> <from uri="direct-vm:routeb" /> <bean ref="requestvalidator" method="validaterequest" /> <log message="the input message ${body}" /> <bean ref="dbclient" method="querydatabase" /> </route>
the cxf configuration pretty simple:
<cxf:rsserver id="simplecxf" address="/test" loggingfeatureenabled="true" serviceclass="com.gogol.test.testresource"> </cxf:rsserver>
this simple route fails below exception
no type converter available convert type: org.apache.cxf.message.messagecontentslist required type: org.apache.camel.exchange value [com.gogol.test.resource.simpleobject@773736ca]
this message history suggests failing @ point <bean ref="requestvalidator" method="validaterequest" />
message history --------------------------------------------------------------------------------------------------------------------------------------- routeid processorid processor elapsed (ms) [routea] [routea] [direct-vm://routea ] [6] [routeb] [log12 ] [log ] [2] [routeb] [to9 ] [direct-vm:routea ] [4] [routea] [bean26] [bean[ref:requestvalidator method: validaterequest]] [2]
i think issue camel trying convert body generated cxf exchange object. because requestvalidator class has method has signature of:
public void validaterequest(exchange exchange) thows someexception.
but ideally message generated cxf should set body inside exchange. correct, if not reason of above exception?
edit:
i using cxf version 3.0.4.redhat-621084 , camel version 2.15.1.redhat-621084
{caused by: org.apache.camel.invalidpayloadexception: no body available of type: org.apache.camel.exchange has value: [com.gogol.schema.testresourcec@6b651b67] of type: org.apache.cxf.message.messagecontentslist on: message: [com.gogol.schema.testresourcec@6b651b67]. caused by: no type converter available convert type: org.apache.cxf.message.messagecontentslist required type: org.apache.camel.exchange value [com.gogol.schema.testresourcec@6b651b67]. exchange[message: [com.gogol.schema.testresourcec@6b651b67]]. caused by: [org.apache.camel.notypeconversionavailableexception - no type converter available convert type: org.apache.cxf.message.messagecontentslist required type: org.apache.camel.exchange value [com.gogol.schema.testresourcec@6b651b67]] @ org.apache.camel.impl.messagesupport.getmandatorybody(messagesupport.java:101)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] @ org.apache.camel.builder.expressionbuilder$42.evaluate(expressionbuilder.java:1037)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] ... 68 more caused by: org.apache.camel.notypeconversionavailableexception: no type converter available convert type: org.apache.cxf.message.messagecontentslist required type: org.apache.camel.exchange value [com.gogol.schema.testresourcec@6b651b67] @ org.apache.camel.impl.converter.basetypeconverterregistry.mandatoryconvertto(basetypeconverterregistry.java:177)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] @ org.apache.camel.core.osgi.osgitypeconverter.mandatoryconvertto(osgitypeconverter.java:122)[203:org.apache.camel.camel-spring:2.15.1.redhat-621084] @ org.apache.camel.impl.messagesupport.getmandatorybody(messagesupport.java:99)[198:org.apache.camel.camel-core:2.15.1.redhat-621084] ... 69 more}
i not positive on camel xml dsl how format properly, can explicitly tell camel type conversion. test theory using convertbodyto call force type conversion.
from("myendpoint") .log("this previous object") .convertbodyto(testresource.class) .log("this object after camel type conversion");
Comments
Post a Comment