Here is a test that illustrates the issue:
import javax.naming.Context;
import junit.framework.Assert;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.util.jndi.JndiContext;
public class CamelBeanEndpointTest extends ContextTestSupport {
public void testRoute() throws Exception {
String stringBody = "stringBody";
String stringResponse =
(String)template.requestBody("direct:in",
stringBody);
Assert.assertEquals(stringBody, stringResponse);
Integer intBody = 1;
Integer intResponse = (Integer)template.requestBody("direct:in",
intBody); //classcastexception
Assert.assertEquals(1, intResponse.intValue());
}
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
from("direct:in").
to("bean:myBean");
}
};
}
@Override
protected Context createJndiContext() throws Exception {
JndiContext answer = new JndiContext();
answer.bind("myBean", new MyBean());
return answer;
}
public static class MyBean {
public Integer intRequest(Integer request) {
return request;
}
public String stringRequest(String request) {
return request;
}
}
}
This unit test fails with a ClassCastException when using Camel 2.0. This
test passes for earlier versions of camel.
I am dead in the water right now, as our application has routes that depend
on camel's bean-binding mechanism. I would really appreciate if someone
could look into this issue.
Thanks,
Sasi
--
View this message in context:
http://www.nabble.com/Bean-endpoint-in-a-route-is-holding-reference-to-the-last-used-methodName-and-does-not-use-Camel%27s-Bean-binding-for-subsequent-messages-tp25838095p25846696.html
Sent from the Camel - Users mailing list archive at Nabble.com.