PDA

View Full Version : Handler method 'null' threw an Exception.



fsancho
Jun 18th, 2008, 07:57 AM
hi all

First of all i have to say that I'm totally newbie to Spring Integration. I'm playing with cafe demo adding support to Message Bus's error-channel and throwing exceptios from handler methods. Here is my configuration xml



<message-bus error-channel="errorChannel"/>
<annotation-driven/>

<context:component-scan base-package="org.springframework.integration.samples.cafe"/>

<channel id="errorChannel" publish-subscribe="true" />
<channel id="orders"/>
<channel id="drinks"/>
<channel id="coldDrinks"/>
<channel id="hotDrinks"/>

<handler-endpoint input-channel="coldDrinks" handler="barista" method="prepareColdDrink" />
<handler-endpoint input-channel="hotDrinks" handler="barista" method="prepareHotDrink" />



I have an errorListener class subscribed to errorChannel, and it log exceptions throwed from prepareColdDrink or prepareHotDrink, but it doesn't get any descriptive information about the exception, only
Handler method 'null' threw an Exception. Here is my errorListener class.



#MessageEndpoint (input="errorChannel")
public class errorListener {

#Handler
public void handle(Message message) {
System.out.println("errorListener: "+message.getPayload());
}

(I have substituted 'at' symbols by # because forum's URL filter)

If the DrinkRouter throws the exception i get a little more descriptive message. The complete path of the method that throwed the exception.



Handler method 'public java.lang.String org.springframework.integration.samples.cafe.Drink Router.resolveDrinkChannel(org.springframework.int egration.samples.cafe.Drink) throws java.lang.Exception' threw an Exception.

I would know what is needed to get, at least, the name of the method that caused the exception.

It would be nice to get a more descriptive information about the exception in errorChannel.

fsancho
Jun 19th, 2008, 04:31 AM
Ok guys, i have found the answer by myself, just googlin' around

osintegration.blogspot.com

sumeetraheja
Jul 8th, 2008, 06:57 AM
Hi would you like to share with all of us how you resolved this , as I am also gettin