Hi,
I just checked the change log of the code, this issue was introduced by
my change of CAMEL-1777[1].
So I created a JIRA[2] for it and will did a quick fix for it.
[1]http://issues.apache.org/activemq/browse/CAMEL-1777
[2]http://issues.apache.org/activemq/browse/CAMEL-2060
Willem
sasidharm wrote:
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