You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by berdoni <be...@gmail.com> on 2013/10/23 14:25:29 UTC

Body is null exception when producing JMS messages from a Quartz endpoint

Hi,

I have the the following route:
from("quartz://MyTrigger/TriggerRouteStart?cron=0+0/5+*+*+*+?")
.routeId("TriggerRouteStart")
.to("activemq:queue:TriggerRouteStart");

This route should trigger every 5mins and put a message to TriggerRouteStart
queue however I get the following error. Shall I set the body before sending
any message to the Queue? I see in Camel documentation the following example
route which is similar:
from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").to("activemq:Totally.Rocks");

Here is my exception:
ERROR|2013-10-23 15:20:59,026|DefaultQuartzScheduler-camel_Worker-10|               
QuartzEndpoint - Error processing exchange. Exchange[Message: [Body is
null]]. Caused by: [org.quartz.JobExecutionException -
org.apache.camel.CamelExecutionException: Exception occurred during
execution on the exchange: Exchange[Message: [Body is null]]]
INFO |2013-10-23 15:20:59,027|DefaultQuartzScheduler-camel_Worker-10|                  
JobRunShell - Job DEFAULT.quartz-endpoint14 threw a JobExecutionException: 
org.quartz.JobExecutionException: org.apache.camel.CamelExecutionException:
Exception occurred during execution on the exchange: Exchange[Message: [Body
is null]] [See nested exception: org.apache.camel.CamelExecutionException:
Exception occurred during execution on the exchange: Exchange[Message: [Body
is null]]]




--
View this message in context: http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Body is null exception when producing JMS messages from a Quartz endpoint

Posted by contactreji <co...@gmail.com>.
You need to initialized the body with some value before sending it to some component wen route is started with timer or quartz 

You can set some arbitory value by using <setBody> tag in your route.  Sending camel exchange with null body to some camel components generated errors.

Refer setBody tag examples on Google 

"berdoni [via Camel]" <ml...@n5.nabble.com> wrote:

>
>
>Hi,
>
>I have the the following route:
>from("quartz://MyTrigger/TriggerRouteStart?cron=0+0/5+*+*+*+?")
>.routeId("TriggerRouteStart")
>.to("activemq:queue:TriggerRouteStart");
>
>This route should trigger every 5mins and put a message to TriggerRouteStart
>queue however I get the following error. Shall I set the body before sending
>any message to the Queue? I see in Camel documentation the following example
>route which is similar:
>from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").to("activemq:Totally.Rocks");
>
>Here is my exception:
>ERROR|2013-10-23 15:20:59,026|DefaultQuartzScheduler-camel_Worker-10|               
>QuartzEndpoint - Error processing exchange. Exchange[Message: [Body is
>null]]. Caused by: [org.quartz.JobExecutionException -
>org.apache.camel.CamelExecutionException: Exception occurred during
>execution on the exchange: Exchange[Message: [Body is null]]]
>INFO |2013-10-23 15:20:59,027|DefaultQuartzScheduler-camel_Worker-10|                  
>JobRunShell - Job DEFAULT.quartz-endpoint14 threw a JobExecutionException: 
>org.quartz.JobExecutionException: org.apache.camel.CamelExecutionException:
>Exception occurred during execution on the exchange: Exchange[Message: [Body
>is null]] [See nested exception: org.apache.camel.CamelExecutionException:
>Exception occurred during execution on the exchange: Exchange[Message: [Body
>is null]]]
>
>
>
>
>_______________________________________________
>If you reply to this email, your message will be added to the discussion below:
>http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072.html
>
>To unsubscribe from Camel - Users, visit http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=Y29udGFjdHJlamlAZ21haWwuY29tfDQ2NTQyOHwxMDA0OTE4MjMz



--
View this message in context: http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072p5742126.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Body is null exception when producing JMS messages from a Quartz endpoint

Posted by Christian Müller <ch...@gmail.com>.
Good to know you got it working...

Best,

Christian
-----------------

Software Integration Specialist

Apache Member
V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer
Apache Incubator PMC Member

https://www.linkedin.com/pub/christian-mueller/11/551/642


On Wed, Oct 23, 2013 at 4:19 PM, berdoni <be...@gmail.com> wrote:

> The v2.12.1 Camel version is used for all camel components, however
> camel-jms
> 2.10.3 is used by activemq-camel component. This jar causes the classpath
> issue as Christian mentioned in his relevant post.
>
> I have updated my pom and it seems OK now with Camel v2.12.1.
>
> <dependency>
>                         <groupId>org.apache.activemq</groupId>
>                         <artifactId>activemq-camel</artifactId>
>                         <version>5.8.0</version>
>                         <exclusions>
>                                 <exclusion>
>                                         <groupId>org.apache.camel</groupId>
>                                         <artifactId>camel-jms</artifactId>
>                                 </exclusion>
>                         </exclusions>
>                 </dependency>
>
>                 <dependency>
>                         <groupId>org.apache.camel</groupId>
>                         <artifactId>camel-jms</artifactId>
>                         <version>2.12.1</version>
>                 </dependency>
>
> Thanks
> Nikos
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072p5742082.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Body is null exception when producing JMS messages from a Quartz endpoint

Posted by berdoni <be...@gmail.com>.
The v2.12.1 Camel version is used for all camel components, however camel-jms
2.10.3 is used by activemq-camel component. This jar causes the classpath
issue as Christian mentioned in his relevant post.

I have updated my pom and it seems OK now with Camel v2.12.1.

<dependency>
			<groupId>org.apache.activemq</groupId>
			<artifactId>activemq-camel</artifactId>
			<version>5.8.0</version>
			<exclusions>
				<exclusion>  
					<groupId>org.apache.camel</groupId>
					<artifactId>camel-jms</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-jms</artifactId>
			<version>2.12.1</version>
		</dependency>

Thanks
Nikos




--
View this message in context: http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072p5742082.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Body is null exception when producing JMS messages from a Quartz endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

This sounds like a classpath issue. Make sure to use the same Camel
version for all your Camel JARs.

On Wed, Oct 23, 2013 at 4:00 PM, berdoni <be...@gmail.com> wrote:
> I did it by adding the following processor but the problem persists.
>
> .process(new Processor() {
>                     public void process(Exchange exchange) {
>                         Message in = exchange.getIn();
>                         in.setBody("Dummy Body");
>                     }
>                 })
>
>
> I found that it works when I downgrade from 2.12.1 to 2.10.3. There is a
> small detail at the bottom of the exception trace:
> "java.lang.NoSuchMethodError:org.apache.camel.util.ObjectHelper.notNull(Ljava/lang/Object;Ljava/lang/String;)V"
>
> I read about this issue in the following post:
> http://camel.465427.n5.nabble.com/camel-2-11-release-with-activemq-camel-5-8-td5733244.html
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072p5742076.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

Re: Body is null exception when producing JMS messages from a Quartz endpoint

Posted by berdoni <be...@gmail.com>.
I did it by adding the following processor but the problem persists.

.process(new Processor() {
		    public void process(Exchange exchange) {
		        Message in = exchange.getIn();
		        in.setBody("Dummy Body");
		    }
		})


I found that it works when I downgrade from 2.12.1 to 2.10.3. There is a
small detail at the bottom of the exception trace:
"java.lang.NoSuchMethodError:org.apache.camel.util.ObjectHelper.notNull(Ljava/lang/Object;Ljava/lang/String;)V"

I read about this issue in the following post:
http://camel.465427.n5.nabble.com/camel-2-11-release-with-activemq-camel-5-8-td5733244.html




--
View this message in context: http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072p5742076.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Body is null exception when producing JMS messages from a Quartz endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
Yes you need to set the body to something, such as constant("") for an
empty string or what you want.

On Wed, Oct 23, 2013 at 2:25 PM, berdoni <be...@gmail.com> wrote:
> Hi,
>
> I have the the following route:
> from("quartz://MyTrigger/TriggerRouteStart?cron=0+0/5+*+*+*+?")
> .routeId("TriggerRouteStart")
> .to("activemq:queue:TriggerRouteStart");
>
> This route should trigger every 5mins and put a message to TriggerRouteStart
> queue however I get the following error. Shall I set the body before sending
> any message to the Queue? I see in Camel documentation the following example
> route which is similar:
> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").to("activemq:Totally.Rocks");
>
> Here is my exception:
> ERROR|2013-10-23 15:20:59,026|DefaultQuartzScheduler-camel_Worker-10|
> QuartzEndpoint - Error processing exchange. Exchange[Message: [Body is
> null]]. Caused by: [org.quartz.JobExecutionException -
> org.apache.camel.CamelExecutionException: Exception occurred during
> execution on the exchange: Exchange[Message: [Body is null]]]
> INFO |2013-10-23 15:20:59,027|DefaultQuartzScheduler-camel_Worker-10|
> JobRunShell - Job DEFAULT.quartz-endpoint14 threw a JobExecutionException:
> org.quartz.JobExecutionException: org.apache.camel.CamelExecutionException:
> Exception occurred during execution on the exchange: Exchange[Message: [Body
> is null]] [See nested exception: org.apache.camel.CamelExecutionException:
> Exception occurred during execution on the exchange: Exchange[Message: [Body
> is null]]]
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Body-is-null-exception-when-producing-JMS-messages-from-a-Quartz-endpoint-tp5742072.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