You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "lakshmi.prashant" <la...@sap.com> on 2014/05/29 10:14:25 UTC

Null Pointer exception with camel quartz simple trigger (fireNow)

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.

Re: Null Pointer exception with camel quartz simple trigger (fireNow)

Posted by "lakshmi.prashant" <la...@sap.com>.
Hi Claus,Thanks for your prompt reply.   1)But what is surprising is that
there is no exception trace + the messages stay in processing state forever.
Also, we are not able to stop / undeploy the camel bundles. Also, I see in
QuartzEndpoint.java line no. 123, it logs an exception similar to what we
see in our logs: 
LOG.error(CamelExchangeException.createExceptionMessage("Error processing
exchange", exchange, e));  2)  When can this condition happen:  ‘Message
exchange stops but no MessageExchangeFailed event is thrown by Camel and our
messages stays in 'PROCESSING' state...  3) Also, this behaviour is not
consistent. In some VM's the routes complete and in some VM's, the messages
stay in processing status..Kindly advise.Thanks,Lakshmi
<http://camel.465427.n5.nabble.com/file/n5751737/camel_NPE.png> 



--
View this message in context: http://camel.465427.n5.nabble.com/Null-Pointer-exception-with-camel-quartz-simple-trigger-fireNow-tp5751692p5751737.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Null Pointer exception with camel quartz simple trigger (fireNow)

Posted by "lakshmi.prashant" <la...@sap.com>.
Hi,
  Thanks for your reply - There is no stack trace and also, we are not able
to debug the issue, as it doesn't reach any of our components in the route. 

  I will look into this closely and follow your suggestion on delay.

Thanks,
Lakshmi



--
View this message in context: http://camel.465427.n5.nabble.com/Null-Pointer-exception-with-camel-quartz-simple-trigger-fireNow-tp5751692p5751734.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Null Pointer exception with camel quartz simple trigger (fireNow)

Posted by Claus Ibsen <cl...@gmail.com>.
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
<la...@sap.com> 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: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/