Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

mamouros
What's my error???
Why do I get the java.lang.NullPointerException ???


I am using this function to terminate a route that is run by a different thread than the main one that calls this function:

private void terminate(String routeId, int index) {
        try {
        System.out.println("%%%%%%%%% camelContext.stopRoute(" + routeId + ");" + " :: THREAD: " + Thread.currentThread().getId());
                camelContext.stopRoute(routeId);
                camelContext.removeRoute(routeId);
                thread_id.get(index).join();
        } catch (Exception e) {
                System.out.println("%%%%%%%%% EXCEPTION in terminate()" + " :: THREAD: " + Thread.currentThread().getId());
                e.printStackTrace();
        }
}


Route is running here:

$$$$$$$$$ Receiver :: account_id: 7 :: smpp://8000800666@123.123.123.123:1111?password=123456 :: THREAD: 579



karaf@root> route-list
Route Id             Context Name         Status
[retrievingAccounts] [ReceivingContext  ] [Started           ]
[receiving:8000800666] [ReceivingContext  ] [Started           ]


Then I call terminate(receiving:8000800666); but I get this exception:
java:174 is camelContext.stopRoute(routeId); from the terminate function above



%%%%%%%%% camelContext.stopRoute(receiving:8000800666); :: THREAD: 573
%%%%%%%%% EXCEPTION in terminate() :: THREAD: 573
java.lang.NullPointerException
        at org.appart.smpp.SmsReceiver.terminate(SmsReceiver.java:174)
        at org.appart.smpp.SmsReceiver.creatingRoutes(SmsReceiver.java:91)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:391)
        at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:278)
        at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:251)
        at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:161)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
        at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67)
        at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)
        at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
        at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
        at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
        at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
        at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:390)
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273)
        at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:335)
        at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
        at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
        at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
        at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
        at org.apache.camel.component.sql.SqlConsumer.processBatch(SqlConsumer.java:164)
        at org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:120)
        at org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:83)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
        at org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:83)
        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:141)
        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)



Reply | Threaded
Open this post in threaded view
|

Re: Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

Claus Ibsen-2
What Camel version do you use?

On Tue, Oct 8, 2013 at 5:08 PM, mamouros <[hidden email]> wrote:

> *What's my error???
> Why do I get the java.lang.NullPointerException ???*
>
> *I am using this function to terminate a route that is run by a different
> thread than the main one that calls this function:*
>
> private void terminate(String routeId, int index) {
>         try {
>                 System.out.println("%%%%%%%%% camelContext.stopRoute(" + routeId +
> ");" + " :: THREAD: " + Thread.currentThread().getId());
>                 camelContext.stopRoute(routeId);
>                 camelContext.removeRoute(routeId);
>                 thread_id.get(index).join();
>         } catch (Exception e) {
>                 System.out.println("%%%%%%%%% EXCEPTION in terminate()" + " :: THREAD: " +
> Thread.currentThread().getId());
>                 e.printStackTrace();
>         }
> }
>
>
> *Route is running here:*
>
> $$$$$$$$$ Receiver :: account_id: 7 ::
> smpp://8000800666@123.123.123.123:1111?password=123456 :: *THREAD: 579
> *
>
>
> karaf@root> route-list
> Route Id             Context Name         Status
> [retrievingAccounts] [ReceivingContext  ] [Started           ]
> [*receiving:8000800666*] [ReceivingContext  ] [Started           ]
>
>
> *Then I call terminate(receiving:8000800666); but I get this exception:
> java:174 is camelContext.stopRoute(routeId); from the terminate function
> above*
>
>
> %%%%%%%%% camelContext.stopRoute(*receiving:8000800666*); :: *THREAD: 573*
> %%%%%%%%% EXCEPTION in terminate() :: THREAD: 573
> java.lang.NullPointerException
>         at org.appart.smpp.SmsReceiver.terminate(SmsReceiver.java:174)
>         at org.appart.smpp.SmsReceiver.creatingRoutes(SmsReceiver.java:91)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
> org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:391)
>         at
> org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:278)
>         at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:251)
>         at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:161)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67)
>         at
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)
>         at
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
>         at
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
>         at
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
>         at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:390)
>         at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273)
>         at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:335)
>         at
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
>         at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
>         at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
>         at
> org.apache.camel.component.sql.SqlConsumer.processBatch(SqlConsumer.java:164)
>         at
> org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:120)
>         at
> org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:83)
>         at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
>         at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
>         at
> org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:83)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:141)
>         at
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
>         at
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:724)
>
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problem-with-stopping-route-camelContext-stopRoute-String-routeId-throws-java-lang-NullPointerExceptn-tp5741141.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [hidden email]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

ceposta
In reply to this post by mamouros
This NPE is coming from your code. What line is 174?
What is thread_id variable?


On Tue, Oct 8, 2013 at 8:08 AM, mamouros <[hidden email]> wrote:

> *What's my error???
> Why do I get the java.lang.NullPointerException ???*
>
> *I am using this function to terminate a route that is run by a different
> thread than the main one that calls this function:*
>
> private void terminate(String routeId, int index) {
>         try {
>                 System.out.println("%%%%%%%%% camelContext.stopRoute(" +
> routeId +
> ");" + " :: THREAD: " + Thread.currentThread().getId());
>                 camelContext.stopRoute(routeId);
>                 camelContext.removeRoute(routeId);
>                 thread_id.get(index).join();
>         } catch (Exception e) {
>                 System.out.println("%%%%%%%%% EXCEPTION in terminate()" +
> " :: THREAD: " +
> Thread.currentThread().getId());
>                 e.printStackTrace();
>         }
> }
>
>
> *Route is running here:*
>
> $$$$$$$$$ Receiver :: account_id: 7 ::
> smpp://8000800666@123.123.123.123:1111?password=123456 :: *THREAD: 579
> *
>
>
> karaf@root> route-list
> Route Id             Context Name         Status
> [retrievingAccounts] [ReceivingContext  ] [Started           ]
> [*receiving:8000800666*] [ReceivingContext  ] [Started           ]
>
>
> *Then I call terminate(receiving:8000800666); but I get this exception:
> java:174 is camelContext.stopRoute(routeId); from the terminate function
> above*
>
>
> %%%%%%%%% camelContext.stopRoute(*receiving:8000800666*); :: *THREAD: 573*
> %%%%%%%%% EXCEPTION in terminate() :: THREAD: 573
> java.lang.NullPointerException
>         at org.appart.smpp.SmsReceiver.terminate(SmsReceiver.java:174)
>         at org.appart.smpp.SmsReceiver.creatingRoutes(SmsReceiver.java:91)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:606)
>         at
> org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:391)
>         at
> org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:278)
>         at
> org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:251)
>         at
>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:161)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at
>
> org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:67)
>         at
>
> org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)
>         at
>
> org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
>         at
>
> org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)
>         at
>
> org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)
>         at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.processor.interceptor.BacklogTracerInterceptor.process(BacklogTracerInterceptor.java:84)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:390)
>         at
>
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:273)
>         at
>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:335)
>         at
>
> org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)
>         at
>
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)
>         at
>
> org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
>         at
>
> org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)
>         at
>
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)
>         at
>
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86)
>         at
>
> org.apache.camel.component.sql.SqlConsumer.processBatch(SqlConsumer.java:164)
>         at
>
> org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:120)
>         at
>
> org.apache.camel.component.sql.SqlConsumer$1.doInPreparedStatement(SqlConsumer.java:83)
>         at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:589)
>         at
> org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)
>         at
> org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:83)
>         at
>
> org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:141)
>         at
>
> org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91)
>         at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
>         at
> java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
>         at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
>         at
>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
>         at
>
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
>         at
>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>         at
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>         at java.lang.Thread.run(Thread.java:724)
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-stopping-route-camelContext-stopRoute-String-routeId-throws-java-lang-NullPointerExceptn-tp5741141.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta
Reply | Threaded
Open this post in threaded view
|

Re: Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

mamouros
@ceposta

As I mention above:
 java:174 is camelContext.stopRoute(routeId); from the terminate function

thread_id variable is an ArrayList<Thread>.
Reply | Threaded
Open this post in threaded view
|

Re: Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

mamouros
In reply to this post by Claus Ibsen-2
@Claus

I use 2.11.0
Reply | Threaded
Open this post in threaded view
|

Re: Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException

mamouros
In reply to this post by mamouros
SOLVED.

It seems that java.lang.NullPointerException was for the CamelContext and not for routeId in line 174:

camelContext.stopRoute(routeId);

where even though camelContext was an instance variable, it wasn't instantiated by the time terminate() was called.