2017-12-27 10 views
0

javaオブジェクトがキューに入ってから整列しようとしていますが、オブジェクトファクトリクラスを正しく記述した後でもInvalidPayloadExceptionが発生しています。以下のコードをご覧ください:キャメルマーシャリング中にInvalidPayloadExceptionが発生しました

//JaxB Config 
JAXBContext jc = JAXBContext.newInstance(com.ObjectFactory.class); 

// POGO configuration in Jaxb component for responsexml insertion 
      JaxbDataFormat jaxbMarshalXmlInsertion = new JaxbDataFormat(jc); 
      jaxbMarshalXmlInsertion .setContextPath(MyPojo.class.getName()); 
      jaxbMarshalXmlInsertion .setPartClass(MyPojo.class.getName()); 



//My Route 
from("vm:ResponseQueue"). 
.log("In response XML body before Marshall-------------->${body}") 
    .marshal(jaxbMarshalXmlInsertion) 
    .log("In response XML body After Marshall-------------->${body}") 
to(vm:XmlQueue); 


//Log(The log before the marshal code is printed correctly in fuse.log) 
In response XML body before Marshall-------------->[email protected] 


//Excerption I got 
InvalidPayloadException: No body available of type: javax.xml.bind.JAXBElement but has value: [email protected] of type: com.MyPojoon: Message[ID-B526DCOK-51386-1514355409371-5-121]. Exchange[ID-B526DCOK-51386-1514355409371-5-122] 

私が逃したものを特定し、この問題を解決するのを手伝ってもらえますか?

答えて

0

from("vm:ResponseQueue"). 
.streamCaching() 
.log("In response XML body before Marshall-------------->${body}") 
    .marshal(jaxbMarshalXmlInsertion) 
    .log("In response XML body After Marshall-------------->${body}") 
to(vm:XmlQueue); 

は詳細返信用http://camel.apache.org/stream-caching.html

+0

感謝を参照してくださいしてみてください。働いていない。同じ例外があります – Hari

関連する問題