3 Replies Latest reply on May 29, 2012 9:07 PM by Tim Zhang

    Problem on involving Timer component

    Tim Zhang Newbie

      I tried to use camel Timer component to do a regular call. It works with following configuration but always got a exception whenever server rebooted.

      Could anyone help on resolving this annoy exception?

       

      Below are the configuration in switchyard.xml and correspoding java code:

      ------------------------------------------------------------------------------------------------------------

      <service name="TimerService" promote="TimerService">

          <camel:binding.camel configURI="timer://myTimer?period=20s" />

      </service>

      ------------------------------------------------------------------------------------------------------------

      import java.util.Date;

      import org.switchyard.component.bean.Service;

       

      @Service(TimerService.class)

      public class TimerServiceImpl implements TimerService{

                public void checkInterval(){

                          System.out.println("now: "+new Date());

                }

      }

      ------------------------------------------------------------------------------------------------------------

      When starting deploying into Switchyard AS, exception is like below:

       

      18:03:02,720 ERROR [org.apache.camel.component.timer.TimerConsumer] (Camel (camel-19) thread #54 - timer://myTimer) Error processing exchange. Exchange[Message: [Body is null]]. Caused by: [java.lang.NullPointerException - No ServiceReference was found for uri [switchyard://TimerService?namespace=urn:switchyard-quickstart:camel-jms-binding:0.1.0]]: java.lang.NullPointerException: No ServiceReference was found for uri [switchyard://TimerService?namespace=urn:switchyard-quickstart:camel-jms-binding:0.1.0]

                at org.switchyard.component.camel.SwitchYardProducer.lookupServiceReference(SwitchYardProducer.java:96) [switchyard-component-camel-0.5.0-SNAPSHOT.jar:0.5.0-SNAPSHOT]

                at org.switchyard.component.camel.SwitchYardProducer.process(SwitchYardProducer.java:80) [switchyard-component-camel-0.5.0-SNAPSHOT.jar:0.5.0-SNAPSHOT]

                at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:304) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:50) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.component.timer.TimerConsumer.sendTimerExchange(TimerConsumer.java:134) [camel-core-2.9.2.jar:2.9.2]

                at org.apache.camel.component.timer.TimerConsumer$1.run(TimerConsumer.java:63) [camel-core-2.9.2.jar:2.9.2]

                at java.util.TimerThread.mainLoop(Timer.java:512) [rt.jar:1.6.0_27]

                at java.util.TimerThread.run(Timer.java:462) [rt.jar:1.6.0_27]

      18:03:22,677 INFO  [stdout] (Camel (camel-19) thread #54 - timer://myTimer) now: Mon May 28 18:03:22 CST 2012