camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Dubchak <j...@johndubchak.com>
Subject Question re: camel-quartz event triggers
Date Thu, 06 Mar 2014 17:30:11 GMT
Hi,

I have a simple route in Java DSL that uses a cron scheduler.  The 
scheduler fires every minute (for my testing) and I am attempting to 
have it call a bean, also in the same bundle, that uses an exported 
service that is already deployed.

Here is the blueprint.xml that sets that up:

<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
     <property name="propertiesFile" value="my_quartz.properties"/>
</bean>

<!-- this is the exported OSGi service -->
<reference id="notificationService" 
interface="com.example.services.notification.NotificationService" />


<!-- the bean -->
<bean id="schedulerNotification" 
class="com.example.services.scheduler.SchedulerNotification">
     <property name="notifier" ref="notificationService"/>
</bean>

<bean id="schedulerRoute" 
class="com.example.services.scheduler.SchedulerRoute">
     <property name="notification" ref="schedulerNotification"/>
</bean>

<camelContext id="context" trace="true" 
xmlns="http://camel.apache.org/schema/blueprint">
     <routeBuilder ref="schedulerRoute"/>
</camelContext>

Also, here is the RouteBuilder code that generates the error, below:

public void configure() throws Exception {
     System.out.println("Scheduler route, with properties file");
from("quartz://my_quartz/daily?cron=0+*+*+*+*+?").process(new Processor() {
         @Override
         public void process(Exchange exchange) throws Exception {
             System.out.println("invoking sendNotification");
             notification.sendNotfication();
         }
     });
}

The bundle is deployed, starts successfully and the quart timer event 
also seems to be working based on the console output I get in my local 
environment - I see the "invoking sendNotification" message printed 
every minute in servicemix. However, I see this error in my log and the 
"sendNotification" method is not invoked:

org.quartz.JobExecutionException: java.lang.NullPointerException [See 
nested exception: java.lang.NullPointerException]
     at 
org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[311:org.apache.camel.camel-quartz:2.10.7]
     at 
org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:61)[311:org.apache.camel.camel-quartz:2.10.7]
     at 
org.quartz.core.JobRunShell.run(JobRunShell.java:223)[309:org.apache.servicemix.bundles.quartz:1.8.6.1]
     at 
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[309:org.apache.servicemix.bundles.quartz:1.8.6.1]
Caused by: java.lang.NullPointerException
     at 
com.example.services.scheduler.SchedulerNotification.sendNotfication(SchedulerNotification.java:31)[415:task-scheduler:1.0.0]
     at 
com.example.services.scheduler.SchedulerRoute$1.process(SchedulerRoute.java:24)[415:task-scheduler:1.0.0]
     at 
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:335)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:308)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.Pipeline.process(Pipeline.java:117)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.Pipeline.process(Pipeline.java:80)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:46)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.RouteInflightRepositoryProcessor.processNext(RouteInflightRepositoryProcessor.java:48)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:44)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:71)[100:org.apache.camel.camel-core:2.10.7]
     at 
org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:113)[311:org.apache.camel.camel-quartz:2.10.7]
     ... 3 more

I know something is not setup correctly, but I'd really appreciate a 
nudge in the direction where that can be found.

Thanks,
John


Mime
View raw message