PDA

View Full Version : unable to resolve reply channel for message



loveam
Dec 21st, 2009, 02:23 AM
hi, I get this error when I using mail:outbound-channel-adapter and recipient-list-router.

this is my code:
<recipient-list-router id="customRouter" input-channel="errorChannel" ignore-send-failures="false">
<recipient channel="mailErrorChannel"/>
<recipient channel="jmsErrorChannel"/>
</recipient-list-router>

<transformer id="testTransformer" input-channel="errorChannel" method="transform" output-channel="mailErrorChannel">
<beans:bean class="com.test.transformer.ErrorToMailMessageTransformer">
<beans:property name="velocityEngine" ref="velocityEngine"/>
</beans:bean>
</transformer>

<mail:outbound-channel-adapter channel="mailErrorChannel" mail-sender="mailSender"/>
<mail:header-enricher subject="ExampleMail" input-channel="mailErrorChannel"
to="xxx@hotmail.com"
from="avvd@gmail.com"
overwrite="false"/>


in the recipient-list-router, I want to send error to email and JMS, JMS is ok, but email is not success, this is error message in JMS,payload is email content.

org.springframework.integration.channel.ChannelRes olutionException: unable to resolve reply channel for message: [Payload=<html>
<body>
<h3>你好, 系统管理员:</h3>

<div>
asdsfdsf
</br>
java.lang.ClassCastException: org.springframework.integration.transformer.Messag eTransformationException cannot be cast to java.util.HashSet
</br>

</br>
sdfdsfsdfdsfsfsdf
</div>
</body>


and I found another error in JMS:

java.lang.IllegalStateException: no value available for the 'MailHeaders.TO' header

but I have set To in the mail:header-enricher

does anybody can help me? thank you very much!

oleg.zhurakousky
Dec 21st, 2009, 06:18 AM
You have recipient-list-router getting message from the errorChannel and distributing it to mailErrorChannel as well as JMS.
You also have transformer which gets message from the errorChannel sending it to the mailErrorChannel.
I am a bit confused as to what are you trying to accomplish here???

Also, you didn't set output-channel on your header-enricher. The outputChannel should be the one from which mail outbound-channel-adapter will be sending from.

loveam
Dec 22nd, 2009, 03:06 AM
I add a output-channel in header-enricher, it is working now, thank you very much!

I just want to learning how to use jms and email in SI, so I want to send error message to email and jms. I add a channel for email, this is my code, I dont know if it is good, but it is working.



<recipient-list-router id="customRouter" input-channel="errorChannel" ignore-send-failures="false">
<recipient channel="errorToMailChannel"/>
<!--
<recipient channel="jmsErrorChannel"/>
-->
</recipient-list-router>

<transformer id="mailTransformer" input-channel="errorToMailChannel" method="transform" output-channel="mailChannel">
<beans:bean class="com.test.transformer.ErrorToMailMessageTransformer">
<beans:property name="velocityEngine" ref="velocityEngine"/>
<beans:property name="templateName" value="mailtemplate.vm"/>
</beans:bean>
</transformer>
<mail:header-enricher subject="${mail.subject}" input-channel="errorChannel" output-channel="errorChannel"
to="${mail.to}"
from="${mail.from}"
overwrite="false"/>
<mail:outbound-channel-adapter channel="mailChannel" mail-sender="mailSender"/>