Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 14F5B10E14 for ; Tue, 8 Oct 2013 15:08:37 +0000 (UTC) Received: (qmail 36331 invoked by uid 500); 8 Oct 2013 15:08:36 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 36281 invoked by uid 500); 8 Oct 2013 15:08:36 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 36272 invoked by uid 99); 8 Oct 2013 15:08:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Oct 2013 15:08:35 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Oct 2013 15:08:30 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VTYtN-0002iC-Hl for users@camel.apache.org; Tue, 08 Oct 2013 08:08:09 -0700 Date: Tue, 8 Oct 2013 08:08:09 -0700 (PDT) From: mamouros To: users@camel.apache.org Message-ID: <1381244889544-5741141.post@n5.nabble.com> Subject: Problem with stopping route. camelContext.stopRoute(String routeId); throws java.lang.NullPointerException MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org *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.