Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.8.0, 2.8.1
-
OS - Windows XP 32 Bit
Java - Sun 1.6_26
Camel - 2.8.0/2.8.1/2.9-SNAPSHOT
-
Patch Available
-
Unknown
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.