[
https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147832#comment-13147832
]
Babak Vahdat commented on CAMEL-4650:
-------------------------------------
I could reproduce your issue on the trunk through a 2 liner change of [1] as
the following:
{code}
public class SedaConcurrentConsumersTest extends ContextTestSupport {
public void testSendToSeda() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedBodiesReceived("Hello World");
template.sendBody("seda:foo?concurrentConsumers=5", "Hello World");
assertMockEndpointsSatisfied();
context.getRoutes().get(0).getConsumer().start();
template.sendBody("seda:foo?concurrentConsumers=5", "Claus absence
today is a showstopper!");
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("seda:foo?concurrentConsumers=5").noAutoStartup().to("mock:result");
from("seda:foo?concurrentConsumers=5").to("mock:result");
}
};
}
}
{code}
Which blows up with a NPE exactly on the same place as yours:
{code}
2011-11-10 17:58:42,108 [main ] INFO DefaultCamelContext
- Apache Camel (CamelContext: camel-1) is starting
2011-11-10 17:58:42,155 [main ] INFO AnnotationTypeConverterLoader
- Found 3 packages with 15 @Converter classes to load
2011-11-10 17:58:42,217 [main ] INFO LazyLoadingTypeConverter
- Loaded 163 core type converters (total 163 type converters)
2011-11-10 17:58:42,327 [main ] INFO DefaultCamelContext
- Cannot start route route1 as its configured with autoStartup=false
2011-11-10 17:58:42,327 [main ] INFO DefaultCamelContext
- Route: route2 started and consuming from:
Endpoint[seda://foo?concurrentConsumers=5]
2011-11-10 17:58:42,327 [main ] INFO DefaultCamelContext
- Total 2 routes, of which 1 is started.
2011-11-10 17:58:42,327 [main ] INFO DefaultCamelContext
- Apache Camel (CamelContext: camel-1) started in 0.282 seconds
2011-11-10 17:58:42,358 [main ] INFO MockEndpoint
- Asserting: Endpoint[mock://result] is satisfied
2011-11-10 17:58:42,358 [main ] INFO DefaultCamelContext
- Apache Camel (CamelContext:camel-1) is shutting down
2011-11-10 17:58:42,358 [main ] INFO DefaultShutdownStrategy
- Starting to graceful shutdown 1 routes (timeout 10 seconds)
2011-11-10 17:58:42,374 [#1 - seda://foo] ERROR SedaConsumer
- Error processing exchange. Exchange[Message: Second Hello World]. Caused by:
[java.lang.NullPointerException - null]
java.lang.NullPointerException
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[file:/D:/Data/eclipse-workspace/camel/camel-core/target/classes/:]
at
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:210)[file:/D:/Data/eclipse-workspace/camel/camel-core/target/classes/:]
at
org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:155)[file:/D:/Data/eclipse-workspace/camel/camel-core/target/classes/:]
at
org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:129)[file:/D:/Data/eclipse-workspace/camel/camel-core/target/classes/:]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]
2011-11-10 17:58:43,374 [ - ShutdownTask] INFO DefaultShutdownStrategy
- Route: route2 shutdown complete, was consuming from:
Endpoint[seda://foo?concurrentConsumers=5]
2011-11-10 17:58:43,374 [main ] INFO DefaultShutdownStrategy
- Graceful shutdown of 1 routes completed in 1 seconds
2011-11-10 17:58:43,374 [main ] INFO DefaultInflightRepository
- Shutting down with no inflight exchanges.
2011-11-10 17:58:43,374 [main ] INFO DefaultCamelContext
- Uptime: 1.329 seconds
2011-11-10 17:58:43,374 [main ] INFO DefaultCamelContext
- Apache Camel (CamelContext: camel-1) is shutdown in 1.016 seconds
{code}
This is a clear evidence for me that while you start the drainer route, the
main route is *still* running causing the NPE as a side effect.
Again IMHO you misuse the Camel's provided Java-DSL. See my previous comments
on this ticket for a possible fix of it.
I leave the closing of this ticket to you, as to my understanding it's
definitely *not* a bug but just a side effect of the API-misusage.
Good luck
Babak
[1]
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/component/seda/SedaConcurrentConsumersTest.java
> NPE when using SEDA route and attaching an extra consumer
> ---------------------------------------------------------
>
> Key: CAMEL-4650
> URL: https://issues.apache.org/jira/browse/CAMEL-4650
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 2.8.2
> Environment: Java 6, Camel 2.8.2, Centos 4.
> Reporter: Tarjei Huse
>
> I'm trying to construct a system for moving some seda queues over to
> ActiveMQ during system shutdown. What I did was create a Route that
> connects to some of my seda queues and then drains the queue to activemq.
> Basicly I got two routes, the drainer:
> from("seda:" + sedaId + "?size=1000")
> .routeId(routeName +
> sedaIs).noAutoStartup().to(activeMQFailuresQueue);
> And the main route:
> from("seda:" + sedaId + "?size=1000")
> .routeId(routeName + sedaIs).to(SomeProcessor);
> Now, sometimes the main route stalls for various reasons I need to
> restart the jvm process it is running in, so I start the first route.
> But when trying this in production, I got:
> java.lang.NullPointerException
> at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:78)
> at
> org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:210)
> at
> org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:155)
> at
> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:129)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:619)
> Bvahdat added a comment:
> just a very tiny pointer:
> Looking at the source it seems that the
> SedaEndpoint.getConsumerMulticastProcessor() method returns 'null' causing
> the NPE, as the condition:
> multicastStarted == false || consumerMulticastProcessor == null
> is true.
--
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