Camel activemq component nosuchmethod exception

392 Views Asked by At

I am using activemq component to send/receive messages, however when I split() the body(), am getting this below exception. I am using camel 2.23.0 version. can someone advise what is wrong?

This is an example of a route which causes this issue:

from("activemq:queue:aaa")
.process("myprocessor")
.split().body()
.to("activemq:queue:bbb")

I have no issues if I use this way:

from("activemq:queue:aaa")
.process("myprocessor")

Inside MyProcessor,

process(Exchange exchange) {
   for (String body : exchange.getIn().getBody(List.class)) {
     ProducerTemplate.sendBody("activemq:queue:bbb",body);
   }
 }

Exception:

Caused by: java.lang.NoSuchMethodError: org.apache.camel.component.jms.JmsMessage.getCamelContext()Lorg/apache/camel/CamelContext;
    at org.apache.camel.component.jms.JmsMessage.newInstance(JmsMessage.java:195)
    at org.apache.camel.component.jms.JmsMessage.newInstance(JmsMessage.java:40)
    at org.apache.camel.impl.MessageSupport.copy(MessageSupport.java:152)
    at org.apache.camel.impl.DefaultExchange.copy(DefaultExchange.java:116)
    at org.apache.camel.impl.DefaultExchange.copy(DefaultExchange.java:90)
    at org.apache.camel.util.ExchangeHelper.createCopy(ExchangeHelper.java:301)
    at org.apache.camel.processor.Splitter.copyExchangeNoAttachments(Splitter.java:291)
    at org.apache.camel.processor.Splitter.access$100(Splitter.java:56)
    at org.apache.camel.processor.Splitter$SplitterIterable.<init>(Splitter.java:158)
    at org.apache.camel.processor.Splitter$SplitterIterable.<init>(Splitter.java:144)
    at org.apache.camel.processor.Splitter.createProcessorExchangePairsIterable(Splitter.java:141)
    at org.apache.camel.processor.Splitter.createProcessorExchangePairsList(Splitter.java:245)
    at org.apache.camel.processor.Splitter.createProcessorExchangePairs(Splitter.java:129)
    at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:241)
1

There are 1 best solutions below

0
On

Beside the potential classpath issues Claus Ibsen commented about, I wonder what you are trying to achieve.

Your MyProcessor iterates over the parts of the message body (a List) and sends each part to the queue bbb. Then you use a Splitter in your Camel Route and send the parts to the queue bbb?

Doesn't your MyProcessor do the same as the rest of your Camel route?