3 Replies Latest reply on May 29, 2012 9:07 PM by tim.qing.zhang

    Problem on involving Timer component

    tim.qing.zhang

      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

        • 1. Re: Problem on involving Timer component
          kcbabo

          Hmm ... looks like it could be a startup ordering issue, but the service reference should be activated before the service binding is started.  I will check it out.

          • 2. Re: Problem on involving Timer component
            kcbabo

            I'm unable to reproduce this in my environment.  From your stacktrace it looks like maybe you changed the camel-jms-binding around a bit and replaced the jms binding with a timer.  Is that right?  I did the same thing, but used the camel-binding quickstart.  Restarted my server several times and never got an exception. 

             

            Might want to start with a clean distro with no deployments and try again.  If it still doesn't work, please attach your modified project so we can see what's going on.  It's possible that the config in your switchyard.xml is a bit off.

            • 3. Re: Problem on involving Timer component
              tim.qing.zhang

              It looks this problem was caused by service cross impact. I have removed other un-related services in switchyard.xml and rebuilded it.

              It works now.

              Thank you for your time.