[ https://issues.apache.org/jira/browse/CAMEL-4542?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Willem Jiang updated CAMEL-4542: -------------------------------- Description: The splitter component can use a bean with a "split method". It seems that this "split bean" is handled as expression and resolved lately using Camel Context from current exchange. If I send an exchange using a separate CamelContext ("client") <camelContext id="client" xmlns="http://camel.apache.org/schema/spring"> </camelContext> to a route defined in another CamelContext ("server") using in-memory transport like "direct" or "vm" <camelContext id="server" xmlns="http://camel.apache.org/schema/spring"> <route id="route02" trace="false" streamCache="false"> <from uri="vm:route02"/> <split> <method bean ="stringLineSplitter" method="split"/> <log message="before sending: ${body}"/> <inOut uri ="vm:route04"/> <log message="after sending"/> </split> <to uri="mock:route02"/> </route> </camelContext> the test fails with "Cannot find class: stringLineSplitter" (Camel 2.8.0). "org.apache.camel.NoSuchBeanException - No bean could be found in the registry for: stringLineSplitter" (Camel 2.9-SNAPSHOT) If I understood Camel right it fails because it tries to resolve this bean based on client Camel Context which is still set at the current exchange send from "client" to "server" but it doesn't contain the bean. If I send an exchange using same "client" CamelContext to another route in "server" CamelContext involving "external" components like "jms" (ActiveMQ) <camelContext id="server" xmlns="http://camel.apache.org/schema/spring"> <route id="route03" trace="false" streamCache="false"> <from uri="jms:queue:route03"/> <split> <method bean ="stringLineSplitter" method="split"/> <log message="before sending: ${body}"/> <inOut uri ="vm:route04"/> <log message="after sending"/> </split> <to uri="mock:route03"/> </route> </camelContext> the test passed successfully. It seems that "jms" component creates a new exchange using "server" CamelContext. was: The splitter component can use a bean with a "split method". It seems that this "split bean" is handled as expression and resolved lately using Camel Context from current exchange. If I send an exchange using a separate CamelContext ("client") <camelContext id="client" xmlns="http://camel.apache.org/schema/spring"> </camelContext> to a route defined in another CamelContext ("server") using in-memory transport like "direct" or "vm" <camelContext id="server" xmlns="http://camel.apache.org/schema/spring"> <route id="route02" trace="false" streamCache="false"> <from uri="vm:route02"/> <split> <method bean ="stringLineSplitter" method="split"/> <log message="before sending: ${body}"/> <inOut uri ="vm:route04"/> <log message="after sending"/> </split> <to uri="mock:route02"/> </route> </camelContext> the test fails with "Cannot find class: stringLineSplitter" (Camel 2.8.0). "org.apache.camel.NoSuchBeanException - No bean could be found in the registry for: stringLineSplitter" (Camel 2.9-SNAPSHOT) If I understood Camel right it fails because it tries to resolve this bean based on client Camel Context which is still set at the current exchange send from "client" to "server" but it doesn't contain the bean. If I send an exchange using same "client" CamelContext to another route in "server" CamelContext involving "external" components like "jms" (ActiveMQ) <camelContext id="server" xmlns="http://camel.apache.org/schema/spring"> <route id="route03" trace="false" streamCache="false"> <from uri="jms:queue:route03"/> <split> <method bean ="stringLineSplitter" method="split"/> <log message="before sending: ${body}"/> <inOut uri ="vm:route04"/> <log message="after sending"/> </split> <to uri="mock:route03"/> </route> </camelContext> the test passed successfully. It seems that "jms" component creates a new exchange using "server" CamelContext. Affects Version/s: (was: 2.9.0) Fix Version/s: 2.9.0 > Can't find splitter bean in registry using multiple camel contexts with "vm" > endpoint > ------------------------------------------------------------------------------------- > > Key: CAMEL-4542 > URL: https://issues.apache.org/jira/browse/CAMEL-4542 > Project: Camel > Issue Type: Bug > Components: camel-core > Affects Versions: 2.8.0, 2.8.1 > Environment: OS - Windows XP 32 Bit > Java - Sun 1.6_26 > Camel - 2.8.0/2.8.1/2.9-SNAPSHOT > Reporter: Bernd Fischer > Assignee: Willem Jiang > Labels: newbie, test-patch > Fix For: 2.9.0 > > Attachments: MethodCallExpression.java.diff, testcase.zip > > > The splitter component can use a bean with a "split method". It seems that > this "split bean" is handled as expression and resolved lately using Camel > Context from current exchange. > If I send an exchange using a separate CamelContext ("client") > <camelContext id="client" xmlns="http://camel.apache.org/schema/spring"> > </camelContext> > to a route defined in another CamelContext ("server") using in-memory > transport like "direct" or "vm" > <camelContext id="server" xmlns="http://camel.apache.org/schema/spring"> > <route id="route02" trace="false" streamCache="false"> > <from uri="vm:route02"/> > <split> > <method bean ="stringLineSplitter" method="split"/> > <log message="before sending: ${body}"/> > <inOut uri ="vm:route04"/> > <log message="after sending"/> > </split> > <to uri="mock:route02"/> > </route> > </camelContext> > the test fails with > "Cannot find class: stringLineSplitter" (Camel 2.8.0). > "org.apache.camel.NoSuchBeanException - No bean could be found in the > registry for: stringLineSplitter" (Camel 2.9-SNAPSHOT) > If I understood Camel right it fails > because it tries to resolve this bean based on client Camel Context > which is still set at the current exchange send from "client" to "server" but > it > doesn't contain the bean. > If I send an exchange using same "client" CamelContext to another route in > "server" CamelContext involving "external" components like "jms" (ActiveMQ) > <camelContext id="server" xmlns="http://camel.apache.org/schema/spring"> > <route id="route03" trace="false" streamCache="false"> > <from uri="jms:queue:route03"/> > <split> > <method bean ="stringLineSplitter" method="split"/> > <log message="before sending: ${body}"/> > <inOut uri ="vm:route04"/> > <log message="after sending"/> > </split> > <to uri="mock:route03"/> > </route> > </camelContext> > the test passed successfully. It seems that "jms" component creates a > new exchange using "server" CamelContext. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira