0

DefautMessage クラスを再利用して、本文を seda コンポーネントに送信しようとしています。私のメッセージクラスは実装なしで以下に示されています。

public class TestMessage extends DefaultMessage{
}

それから私はそれにアクセスしています

TestMessage msg = new TestMessage();
            msg.setBody(doc);
            getCamelContext().createProducerTemplate().sendBody("seda:inputDoc",msg);

しかし、アプリケーションの実行中に、次の例外が発生します。

Caused by: org.apache.camel.InvalidPayloadException: No body available of type: org.dom4j.Document but has value: Message: org.dom4j.tree.DefaultDocument@122bfd6 [Document: name testDocument] of type: com.test.TestMessage on: Message: Message: org.dom4j.tree.DefaultDocument@122bfd6 [Document: name testDocument]

実装の何が問題になっていますか?

4

2 に答える 2

0

間違ったオブジェクトをラップしていると思います org.dom4j.Document を期待していますが、org.dom4j.tree.DefaultDocument を取得しました

ドキュメントタイプとは??

于 2012-05-08T19:47:20.787 に答える
0

通常、独自のメッセージ クラスを定義する必要はありません。camel の DefaultMessage を使用して、必要な本文とヘッダーを設定するだけです。DefaultMessage を拡張しようとした特別な理由はありますか?

于 2012-05-09T05:47:09.537 に答える