You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Tarjei Huse (Created) (JIRA)" <ji...@apache.org> on 2011/11/09 11:48:51 UTC

[jira] [Created] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

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

        

[jira] [Issue Comment Edited] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147042#comment-13147042 ] 

Babak Vahdat edited comment on CAMEL-4650 at 11/9/11 3:47 PM:
--------------------------------------------------------------

@Tarjei, could you please give me some hints:

Are your both routes (you called them the main & the drainer one) in the same camel context? If so I wonder how it should work *at all* as you would consume twice using exactly the same seda uri in the same camel context as soon as you start the drainer route (for example through jmx)! IMHO the camel behaviour in this case would be undefined / unpredictable when a new message would arrive at this time to the seda endpoint.

The Java-DSL doesn't inhibit you to do that and the code would of course compile but at runtime using the from() clause you would *concurrently* consume twice using the same seda endpoint java object, again the uri by both routes seems to me to be exactly the same:

{code}
from("seda:" + sedaId + "?size=1000")
{code}

I propose to use the try/catch or onException clause to send the failed messsages (the not processed ones) to some endpoints (for example "direct:failed") and as soon as you start the drainer route you would consume from that endpoint in drainer route instead of consuming *concurrently* from the seda endpoint together with the main route at *the same time*.

What do you think?
                
      was (Author: bvahdat):
    @Tarjei, could you please give me some hints:

Are your both routes (you called them the main & the drainer one) in the same camel context? If so I wonder how it should work *at all* as you would consume twice using the same seda URI in the same camel context!

The Java-DSL doesn't inhibit you to do that and the code would of course compile but at runtime using the from() clause you would *concurrently* consume twice using the same seda endpoint object, again the URI in both routes seem to me to be exactly the same:

{code}
from("seda:" + sedaId + "?size=1000")
{code}

Or am I wrong?
                  
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Tarjei Huse (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147551#comment-13147551 ] 

Tarjei Huse commented on CAMEL-4650:
------------------------------------

Hi Babak,

1. Yes both routes are in the same context.

2. Yes the point is to consume from the same seda endpoint. Think of this endpoint as a buffer between processes that take differing amounts of time and should not happen sequentially. 

3. I got an errorhandler for shorter errors like this:

.onException(java.net.ConnectException.class, SolrServerException.class, SolrException.class)
	.log(LoggingLevel.ERROR,routeName+ ":Connection down")
				.maximumRedeliveries(4)
				.backOffMultiplier(1)
				.redeliveryDelay(redeliveryDelay)
				.to("log:SolrRouteError?showAll=true&showStackTrace=true&showHeaders=true&showException=true")
				.to(getSolrFailuresQueue())
				.handled(true)
				.end()

The problem is that on some errors the time it takes for a request can be quite long so the seda queue builds up.

Maybe I should shut down the consuming route before starting the drainer - would that help?

                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Tarjei Huse (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147911#comment-13147911 ] 

Tarjei Huse commented on CAMEL-4650:
------------------------------------

Babak, thank you for working on this issue. 

As it stands, it is an api misuse, and I will close the bug.

T
                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150385#comment-13150385 ] 

Claus Ibsen commented on CAMEL-4650:
------------------------------------

Ah sorry I can still reproduce the NPE. Will try to add some configuration check.
                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150411#comment-13150411 ] 

Babak Vahdat commented on CAMEL-4650:
-------------------------------------

I think that the problem/challenge resides in the fact that camel-core doesn't realize that there's already another route consuming from the same URI (in this case the Seda consumer with multipleConsumers *not* enabled) if one of the routes is not autoEnabled and the other one is already up and consuming and one starts that not-autoEnabled route afterwards through the provided API.

However if both routes are already autoEnabled (which is the default) then this case gets caught correctly at the startup of the camel context:

{code}
org.apache.camel.FailedToStartRouteException: Failed to start route route2 because of Multiple consumers for the same endpoint is not allowed: Endpoint[seda://foo?concurrentConsumers=5]
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRouteConsumers(DefaultCamelContext.java:1916)
	at org.apache.camel.impl.DefaultCamelContext.doStartRouteConsumers(DefaultCamelContext.java:1892)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1820)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1604)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1494)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1381)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1359)
	at org.apache.camel.ContextTestSupport.startCamelContext(ContextTestSupport.java:171)
	at org.apache.camel.ContextTestSupport.setUp(ContextTestSupport.java:114)
	at junit.framework.TestCase.runBare(TestCase.java:132)
	at org.apache.camel.TestSupport.runBare(TestSupport.java:59)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
{code}
                
> 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
>            Assignee: Claus Ibsen
>
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150347#comment-13150347 ] 

Claus Ibsen commented on CAMEL-4650:
------------------------------------

Regardless if its an API misuse etc. then Camel should shield itself better and report a IllegalArgumentException or IllegalStateException etc. with a better error description what is wrong.

We should generally avoid any NPE being thrown inside Camel code.
                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ 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

        

[jira] [Reopened] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Claus Ibsen (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reopened CAMEL-4650:
--------------------------------

      Assignee: Claus Ibsen
    
> 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
>            Assignee: Claus Ibsen
>
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150350#comment-13150350 ] 

Babak Vahdat commented on CAMEL-4650:
-------------------------------------

Absolutely agree on that.
                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147042#comment-13147042 ] 

Babak Vahdat commented on CAMEL-4650:
-------------------------------------

@Tarjei, could you please give me some hints:

Are your both routes (you called them the main & the drainer one) in the same camel context? If so I wonder how it should work *at all* as you would consume twice using the same seda URI in the same camel context!

The Java-DSL doesn't inhibit you to do that and the code would of course compile but at runtime using the from() clause you would *concurrently* consume twice using the same seda endpoint object, again the URI in both routes seem to me to be exactly the same:

{code}
from("seda:" + sedaId + "?size=1000")
{code}

Or am I wrong?
                
> 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

        

[jira] [Issue Comment Edited] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147558#comment-13147558 ] 

Babak Vahdat edited comment on CAMEL-4650 at 11/10/11 11:57 AM:
----------------------------------------------------------------

Yeah try stopping the main route first before starting the drainer one and see if you can still reproduce the NPE. And before starting the drainer route make sure that the main route is *really* stopped.

For example with a JMX client like JConsole you can check it through the getState() operation of the main route, of course I assume you have not disabled the Camel's JMX support, see:

http://camel.apache.org/camel-jmx.html#CamelJMX-UsingJMXtomanageApacheCamel
                
      was (Author: bvahdat):
    Yeah try stopping the main route first before starting the drainer one and see if you can still reproduce the NPE. And before starting the drainer route make sure that the main route is *really* stopped.

For example with a JMX client like JConsole you can check it through the getState() operation of the main route, of course I assume you have enabled the Camel's JMX support, see:

http://camel.apache.org/camel-jmx.html#CamelJMX-UsingJMXtomanageApacheCamel
                  
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13146956#comment-13146956 ] 

Babak Vahdat commented on CAMEL-4650:
-------------------------------------

I did a typo in the user forum about the condition which holds, causing the NPE. Correctly it's:

{code}
multicastStarted == true || consumerMulticastProcessor == null
{code}

Looking at SedaConsumer.sendToConsumers() it's:

{code}
    protected void sendToConsumers(Exchange exchange) throws Exception {
        int size = endpoint.getConsumers().size();

        // if there are multiple consumers then multicast to them
        if (size > 1) {

            if (LOG.isDebugEnabled()) {
                LOG.debug("Multicasting to {} consumers for Exchange: {}", endpoint.getConsumers().size(), exchange);
            }
           
            // use a multicast processor to process it
            MulticastProcessor mp = endpoint.getConsumerMulticastProcessor();

            // and use the asynchronous routing engine to support it
            AsyncProcessorHelper.process(mp, exchange, new AsyncCallback() {
                public void done(boolean doneSync) {
                    // noop
                }
            });
        } else {
            // use the regular processor and use the asynchronous routing engine to support it
            AsyncProcessorHelper.process(processor, exchange, new AsyncCallback() {
                public void done(boolean doneSync) {
                    // noop
                }
            });
        }
    }
{code}

Which as you see does call:
{code}
endpoint.getConsumerMulticastProcessor();
{code}

But doesn't take into the account that the returned reference (of type MulticastProcessor) could be null. In your case it *was* null, as apparently the condition I mentioned in user forum holds.  

I would love to provide a patch for this, but the SedaEndpoint is to me one of those non-trivial camel's endpoint (concurrency was / is never trivial :-().

If some camel riders could give me a hint, I would assign the ticket to myself and would provide a patch (including a unit-test) proving the fix.
                
> 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

        

[jira] [Resolved] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Claus Ibsen (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-4650.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.9.0
                   2.8.3

The NPE is now fixed and an error message is reported.

I created a new ticket for the check if multiple consumers is supported when manually starting a route.
                
> 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
>            Assignee: Claus Ibsen
>             Fix For: 2.8.3, 2.9.0
>
>
> 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

        

[jira] [Closed] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Tarjei Huse (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tarjei Huse closed CAMEL-4650.
------------------------------

    Resolution: Not A Problem

Closed as API misuse. 
                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Claus Ibsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13150384#comment-13150384 ] 

Claus Ibsen commented on CAMEL-4650:
------------------------------------

The unit test above can be fixed if you start the route correctly using the startRoute method form CamelContext

                
> 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

        

[jira] [Commented] (CAMEL-4650) NPE when using SEDA route and attaching an extra consumer

Posted by "Babak Vahdat (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CAMEL-4650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13147558#comment-13147558 ] 

Babak Vahdat commented on CAMEL-4650:
-------------------------------------

Yeah try stopping the main route first before starting the drainer one and see if you can still reproduce the NPE. And before starting the drainer route make sure that the main route is *really* stopped.

For example with a JMX client like JConsole you can check it through the getState() operation of the main route, of course I assume you have enabled the Camel's JMX support, see:

http://camel.apache.org/camel-jmx.html#CamelJMX-UsingJMXtomanageApacheCamel
                
> 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