Hi Sounds like you have an exception being thrown during routing, and the quartz component just logs that.
So either use an error handler to handle that exception. Or do not use fireNow, but use a delay so quartz does not fire asap, but give a bit of time for the other resources to be ready. On Thu, May 29, 2014 at 10:14 AM, lakshmi.prashant <[email protected]> wrote: > Hi, > > We are using camel 2.12.3 distribution with quartz 1.8.6. > We are repeatedly facing NullPointer issues with the quartz endpoint and > the route is failing at the beginning in the quartz endpoint. After that > the message in the route doesn't complete at all. > > We have faced this issue mainly with the run once immediately (fireNow) > simple trigger: > > <camel:from uri="quartz://TestNPETimerEventDefinition11?fireNow=true"/> > > > Error Message that we can find in the log is as follows: > > ERROR#org.apache.camel.component.quartz.QuartzEndpoint##anonymous#DefaultQuartzScheduler-592-TestNPE_IFlow##Error > processing exchange. Exchange[Message: [Body is null]]. Caused by: > [java.lang.NullPointerException - while trying to invoke the method > java.io.InputStream.read(byte[]) of an object loaded from field > javax.crypto.CipherInputStream.input of an object loaded from local variable > '<0>']| > > (or) sometimes we get the below error: > > ERROR#org.apache.camel.component.quartz.QuartzEndpoint##anonymous#DefaultQuartzScheduler- > ##Error processing exchange. Exchange[Message: [Body is null]]. > Caused by: [java.lang.NullPointerException - while trying to invoke the > method java.lang.Object.toString() of an object returned from > java.util.Map$Entry.getValue()]| > > > In QuartzEndpoint.java, we see the error being thrown as follows. > > > http://grepcode.com/file/repo1.maven.org/maven2/org.apache.camel/camel-quartz/2.12.3/org/apache/camel/component/quartz/QuartzEndpoint.java?av=f > > > public void onJobExecute(final JobExecutionContext jobExecutionContext) > throws JobExecutionException { > 100 boolean run = true; > 101 LoadBalancer balancer = getLoadBalancer(); > 102 if (balancer instanceof ServiceSupport) { > 103 run = ((ServiceSupport) balancer).isRunAllowed(); > 104 } > 105 > 106 if (!run) { > 107 // quartz scheduler could potential trigger during a route > has been shutdown > 108 LOG.warn("Cannot execute Quartz Job with context: " + > jobExecutionContext + " because processor is not started: " + balancer); > 109 return; > 110 } > 111 > 112 LOG.debug("Firing Quartz Job with context: {}", > jobExecutionContext); > 113 Exchange exchange = createExchange(jobExecutionContext); > 114 try { > 115 balancer.process(exchange); > 116 > 117 if (exchange.getException() != null) { > 118 // propagate the exception back to Quartz > 119 throw new JobExecutionException(exchange.getException()); > 120 } > 121 } catch (Exception e) { > 122 // log the error > 123 * LOG.error(CamelExchangeException.createExceptionMessage("Error > processing exchange", exchange, e));*124 > 125 // and rethrow to let quartz handle it > 126 if (e instanceof JobExecutionException) { > 127 throw (JobExecutionException) e; > 128 } > 129 throw new JobExecutionException(e); > 130 } > 131 } > 132 > > > Can you please point me why the issue is happening and what we can do to fix > the issue? > Any help / pointers is greatly appreciated. > > Many Thanks, > Lakshmi > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Null-Pointer-exception-with-camel-quartz-simple-trigger-fireNow-tp5751692.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
