You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bru1900 <ra...@gmail.com> on 2013/03/22 20:45:19 UTC

Cannot write null body to file error !

I am newly learning how to set up routes in camel, and Quartz schedule them.

I wrote a simple xml config, 
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
       http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">

  <camelContext trace="false" xmlns="http://camel.apache.org/schema/spring">
    <route id="simple">

		 <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
	     <log message="Moving message to Folder"/>
        <to uri="file:C:\Data\FuseJars\messages"/>
    </route>
</camelContext>

</beans>

The simple file transfer works, but when i added the scheduling part am
getting the following error. 
Any help will be highly appreciated.

[artzScheduler-camel-1_Worker-5] QuartzEndpoint                 ERROR Error
processing exchange. Exchange[Message: [Body is null]]. Caused by:
[org.quartz.JobExecutionException -
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
write null body to file:
C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
[artzScheduler-camel-1_Worker-5] JobRunShell                    INFO  Job
DEFAULT.quartz-endpoint1 threw a JobExecutionException: 
org.quartz.JobExecutionException:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
write null body to file:
C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29 [See
nested exception:
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
write null body to file:
C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
	at
org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
	at
org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
	at
org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
[artzScheduler-camel-1_Worker-6] simple                         INFO  Moving
message to Folder
[



--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by bru1900 <ra...@gmail.com>.
Marco,

Thank you for these references. I have tried the first option you suggested
before hand.
Am trying to incorporate quartz scheduling into the similar way.

I need to design a route, which moves file from a source directory to
target directory, following a cron schedule.

In the (2) option, a new file gets created with contents of the text file,
but i need the actual file to be moved, like it would happen in option (1).



On Mon, Mar 25, 2013 at 11:12 AM, Marco Westermann [via Camel] <
ml-node+s465427n5729766h84@n5.nabble.com> wrote:

> Hi,
>
> first you need a basic understanding of the route parts (endpoints) you
> are using. If I understand you correct you have files in your source
> directory which you want to move to a destination directory at a given
> time?! Then you have three alternatives how to archive this.
>
> 1.
> poll a directory with the file consumer  endpoint
>
> <from uri="file://src/data"/>
>
> <to uri="file:C:\Data\FuseJars\messages"/>
>
>
> That would move all files which appears in the src folder to the
> messages folder. If you now want to move the files on a specified time,
> you can only start the route at that time. For that have a look at:
> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>
>
> 2. Your problem is, that the body of the message has to contain the file
> content you want to move. The quartz consumer endpoint you use just
> sends out an empty body like Christian already explained.
> To set the content of the messagebody to the filecontent you can use a
> pollenrich. Have a look here:
> http://camel.apache.org/content-enricher.html
>
> then your route would look similar to:
>
> <from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
>    <log message="Writing message to Folder"/>
>    <pollEnrich uri="file://src/data?fileName=data.txt"/>
>    <to uri="file:C:\Data\FuseJars\messages"/>
>
> 3. Use a java bean which moves the files with pure java code
>
> <from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
>
>      <to uri="bean:fileMover"/>
>
> For how to use beans in camel have a look here:
> http://camel.apache.org/bean.html
>
> I hope this helps understanding how camel works. I also can recommend
> the book "camel in action" which gives a good overview of how camel
> works and dives you into the different aspects of using camel.
>
> regards, Marco
>
>
>
>
> Am 25.03.2013 15:34, schrieb bru1900:
>
> > Christian,
> >
> > So in this case, a new file is being written into the target folder with
> > the Content "Camel Rocks".
> >
> > But am looking to move a file from the source folder to the
> destination...
> > how can i do that? using quartz schedule !
> >
> > Thank you,
> > Remya
> >
> >
> > On Fri, Mar 22, 2013 at 5:56 PM, Christian Mueller [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729766&i=0>>
> wrote:
> >
> >> <route id="simple">
> >>    <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> >>    <log message="Writing message to Folder"/>
> >>    <setBody><constant>Camel rocks</constant></setBody>
> >>    <to uri="file:C:\Data\FuseJars\messages"/>
> >> </route>
> >>
> >> Best,
> >> Christian
> >>
> >> On Fri, Mar 22, 2013 at 10:15 PM, bru1900 <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5729705&i=0>>
> >> wrote:
> >>
> >>> Am sorry about my lack of understanding.
> >>>
> >>> But by adding <setBody><constant>Camel rocks</constant></setBody> to
> the
> >>> file endpoint you mean? which file?
> >>>
> >>> This is my context file(that am executing) and the other is my msg
> file
> >> (
> >>> present in src/data)
> >>>
> >>>
> >>> On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
> >>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5729705&i=1>>
>
> >> wrote:
> >>>> By using "quartz://src/data" it looks like you want route messages
> >> from
> >>>> the
> >>>> src/data folder. But in this case "src" is the timer group name and
> >>> "data"
> >>>> is the timer name.
> >>>> And the quartz component sends an empty message (with a null body).
> >>> That's
> >>>> what the file component complians. If you add something like:
> >>>> <setBody><constant>Camel rocks</constant></setBody>
> >>>>
> >>>> before your file endpoint, it should work...
> >>>>
> >>>> Best,
> >>>> Christian
> >>>>
> >>>> On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<
> >>> http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
> >>>> wrote:
> >>>>
> >>>>> I did look at these documents, in one of the examples, the suggested
> >>> was
> >>>>> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
> >>>>>
> >>>>> i am trying to do a similar thing in xml configuration. Where am i
> >>> going
> >>>>> wrong?
> >>>>>
> >>>>>
> >>>>>
> >>>>> On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
> >>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
>
> >>>> wrote:
> >>>>>> Your Quartz URI is not valid. You can read more about it at [1].
> >>>>>> I think you are looking for the cron scheduled route policy [2].
> >>>>>>
> >>>>>> [1] http://camel.apache.org/quartz.html
> >>>>>> [2] http://camel.apache.org/cronscheduledroutepolicy.html
> >>>>>>
> >>>>>> Best,
> >>>>>> Christian
> >>>>>>
> >>>>>> On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
> >>>>> http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> I am newly learning how to set up routes in camel, and Quartz
> >>>> schedule
> >>>>>>> them.
> >>>>>>>
> >>>>>>> I wrote a simple xml config,
> >>>>>>> <?xml version="1.0" encoding="UTF-8"?>
> >>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
> >>>>>>>         xmlns:camel="http://camel.apache.org/schema/spring"
> >>>>>>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >>>>>>>         xsi:schemaLocation="
> >>>> http://www.springframework.org/schema/beans
> >>>>>>> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> >>>>>>>         http://camel.apache.org/schema/spring
> >>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd">
> >>>>>>>
> >>>>>>>    <camelContext trace="false" xmlns="
> >>>>>> http://camel.apache.org/schema/spring
> >>>>>>> ">
> >>>>>>>      <route id="simple">
> >>>>>>>
> >>>>>>>                   <from
> >> uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> >>>>>>>               <log message="Moving message to Folder"/>
> >>>>>>>          <to uri="file:C:\Data\FuseJars\messages"/>
> >>>>>>>      </route>
> >>>>>>> </camelContext>
> >>>>>>>
> >>>>>>> </beans>
> >>>>>>>
> >>>>>>> The simple file transfer works, but when i added the scheduling
> >>> part
> >>>> am
> >>>>>>> getting the following error.
> >>>>>>> Any help will be highly appreciated.
> >>>>>>>
> >>>>>>> [artzScheduler-camel-1_Worker-5] QuartzEndpoint
> >>>> ERROR
> >>>>>> Error
> >>>>>>> processing exchange. Exchange[Message: [Body is null]]. Caused
> >> by:
> >>>>>>> [org.quartz.JobExecutionException -
> >>>>>>>
> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
> >>>>>> Cannot
> >>>>>>> write null body to file:
> >>>>>>>
> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> >>>>>>> [artzScheduler-camel-1_Worker-5] JobRunShell
> >>>   INFO
> >>>>>>   Job
> >>>>>>> DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> >>>>>>> org.quartz.JobExecutionException:
> >>>>>>>
> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
> >>>>>> Cannot
> >>>>>>> write null body to file:
> >>>>>>>
> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
> >>>> [See
> >>>>>>> nested exception:
> >>>>>>>
> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
> >>>>>> Cannot
> >>>>>>> write null body to file:
> >>>>>>>
> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> >>>>>>>          at
> >>>>>>>
> >>>>>>>
> >>
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> >>
> >>>>>>>          at
> >>>>>>>
> >>>>>>>
> >>
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> >>
> >>>>>>>          at
> >>>>>>>
> >>>
> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> >>>>>>>          at
> >>>>>>>
> >>>>>>>
> >>
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
>
> >>
> >>>>>>> [artzScheduler-camel-1_Worker-6] simple
> >>> INFO
> >>>>>>>   Moving
> >>>>>>> message to Folder
> >>>>>>> [
> >>>>>>>
> >>>>>>>
> >>>>>>>
> >>>>>>> --
> >>>>>>> View this message in context:
> >>>>>>>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> >>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>>>>>
> >>>>>>
> >>>>>> ------------------------------
> >>>>>>   If you reply to this email, your message will be added to the
> >>>> discussion
> >>>>>> below:
> >>>>>>
> >>>>>>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
> >>>>>>   To unsubscribe from Cannot write null body to file error !, click
> >>>> here<
> >>>>>
> >>>>>> .
> >>>>>> NAML<
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >>>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> --
> >>>>> View this message in context:
> >>>>>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
> >>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>>>
> >>>>
> >>>> ------------------------------
> >>>>   If you reply to this email, your message will be added to the
> >> discussion
> >>>> below:
> >>>>
> >>>>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
> >>
> >>>>   To unsubscribe from Cannot write null body to file error !, click
> >> here<
> >>>
> >>>> .
> >>>> NAML<
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >>>>
> >>>
> >>> camelContext.xml (1K) <
> >>>
> http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml>
> >>> message2.xml (286 bytes) <
> >>> http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml>
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> View this message in context:
> >>>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
> >>
> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >>>
> >>
> >> ------------------------------
> >>   If you reply to this email, your message will be added to the
> discussion
> >> below:
> >>
> >>
>
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
> >>
> >
> >
> >
> > --
> > View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729760.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729766.html
>  To unsubscribe from Cannot write null body to file error !, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729802.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by Christian Müller <ch...@gmail.com>.
http://camel.apache.org/cronscheduledroutepolicy.html is what you are
looking for...

Sent from a mobile device
Am 25.03.2013 21:04 schrieb "bru1900" <ra...@gmail.com>:

> Am sorry, that worked just as i was looking for !
> Thank you so much Christain and Marco.
>
>
> On Mon, Mar 25, 2013 at 3:57 PM, Remya Nambiar <ra...@gmail.com> wrote:
>
> > Marco,
> >
> > Thank you for these references. I have tried the first option you
> > suggested before hand.
> > Am trying to incorporate quartz scheduling into the similar way.
> >
> > I need to design a route, which moves file from a source directory to
> > target directory, following a cron schedule.
> >
> > In the (2) option, a new file gets created with contents of the text
> file,
> > but i need the actual file to be moved, like it would happen in option
> (1).
> >
> >
> >
> > On Mon, Mar 25, 2013 at 11:12 AM, Marco Westermann [via Camel] <
> > ml-node+s465427n5729766h84@n5.nabble.com> wrote:
> >
> >> Hi,
> >>
> >> first you need a basic understanding of the route parts (endpoints) you
> >> are using. If I understand you correct you have files in your source
> >> directory which you want to move to a destination directory at a given
> >> time?! Then you have three alternatives how to archive this.
> >>
> >> 1.
> >> poll a directory with the file consumer  endpoint
> >>
> >> <from uri="file://src/data"/>
> >>
> >> <to uri="file:C:\Data\FuseJars\messages"/>
> >>
> >>
> >> That would move all files which appears in the src folder to the
> >> messages folder. If you now want to move the files on a specified time,
> >> you can only start the route at that time. For that have a look at:
> >> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
> >>
> >>
> >> 2. Your problem is, that the body of the message has to contain the file
> >> content you want to move. The quartz consumer endpoint you use just
> >> sends out an empty body like Christian already explained.
> >> To set the content of the messagebody to the filecontent you can use a
> >> pollenrich. Have a look here:
> >> http://camel.apache.org/content-enricher.html
> >>
> >> then your route would look similar to:
> >>
> >> <from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
> >>    <log message="Writing message to Folder"/>
> >>    <pollEnrich uri="file://src/data?fileName=data.txt"/>
> >>    <to uri="file:C:\Data\FuseJars\messages"/>
> >>
> >> 3. Use a java bean which moves the files with pure java code
> >>
> >> <from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
> >>
> >>      <to uri="bean:fileMover"/>
> >>
> >> For how to use beans in camel have a look here:
> >> http://camel.apache.org/bean.html
> >>
> >> I hope this helps understanding how camel works. I also can recommend
> >> the book "camel in action" which gives a good overview of how camel
> >> works and dives you into the different aspects of using camel.
> >>
> >> regards, Marco
> >>
> >>
> >>
> >>
> >> Am 25.03.2013 15:34, schrieb bru1900:
> >>
> >> > Christian,
> >> >
> >> > So in this case, a new file is being written into the target folder
> >> with
> >> > the Content "Camel Rocks".
> >> >
> >> > But am looking to move a file from the source folder to the
> >> destination...
> >> > how can i do that? using quartz schedule !
> >> >
> >> > Thank you,
> >> > Remya
> >> >
> >> >
> >> > On Fri, Mar 22, 2013 at 5:56 PM, Christian Mueller [via Camel] <
> >> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729766&i=0
> >>
> >> wrote:
> >> >
> >> >> <route id="simple">
> >> >>    <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> >> >>    <log message="Writing message to Folder"/>
> >> >>    <setBody><constant>Camel rocks</constant></setBody>
> >> >>    <to uri="file:C:\Data\FuseJars\messages"/>
> >> >> </route>
> >> >>
> >> >> Best,
> >> >> Christian
> >> >>
> >> >> On Fri, Mar 22, 2013 at 10:15 PM, bru1900 <[hidden email]<
> >> http://user/SendEmail.jtp?type=node&node=5729705&i=0>>
> >> >> wrote:
> >> >>
> >> >>> Am sorry about my lack of understanding.
> >> >>>
> >> >>> But by adding <setBody><constant>Camel rocks</constant></setBody> to
> >> the
> >> >>> file endpoint you mean? which file?
> >> >>>
> >> >>> This is my context file(that am executing) and the other is my msg
> >> file
> >> >> (
> >> >>> present in src/data)
> >> >>>
> >> >>>
> >> >>> On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
> >> >>> [hidden email] <
> http://user/SendEmail.jtp?type=node&node=5729705&i=1>>
> >>
> >> >> wrote:
> >> >>>> By using "quartz://src/data" it looks like you want route messages
> >> >> from
> >> >>>> the
> >> >>>> src/data folder. But in this case "src" is the timer group name and
> >> >>> "data"
> >> >>>> is the timer name.
> >> >>>> And the quartz component sends an empty message (with a null body).
> >> >>> That's
> >> >>>> what the file component complians. If you add something like:
> >> >>>> <setBody><constant>Camel rocks</constant></setBody>
> >> >>>>
> >> >>>> before your file endpoint, it should work...
> >> >>>>
> >> >>>> Best,
> >> >>>> Christian
> >> >>>>
> >> >>>> On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<
> >> >>> http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
> >> >>>> wrote:
> >> >>>>
> >> >>>>> I did look at these documents, in one of the examples, the
> >> suggested
> >> >>> was
> >> >>>>> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
> >> >>>>>
> >> >>>>> i am trying to do a similar thing in xml configuration. Where am i
> >> >>> going
> >> >>>>> wrong?
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
> >> >>>>> [hidden email] <
> >> http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
> >> >>>> wrote:
> >> >>>>>> Your Quartz URI is not valid. You can read more about it at [1].
> >> >>>>>> I think you are looking for the cron scheduled route policy [2].
> >> >>>>>>
> >> >>>>>> [1] http://camel.apache.org/quartz.html
> >> >>>>>> [2] http://camel.apache.org/cronscheduledroutepolicy.html
> >> >>>>>>
> >> >>>>>> Best,
> >> >>>>>> Christian
> >> >>>>>>
> >> >>>>>> On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
> >> >>>>> http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> >> >>>>>> wrote:
> >> >>>>>>
> >> >>>>>>> I am newly learning how to set up routes in camel, and Quartz
> >> >>>> schedule
> >> >>>>>>> them.
> >> >>>>>>>
> >> >>>>>>> I wrote a simple xml config,
> >> >>>>>>> <?xml version="1.0" encoding="UTF-8"?>
> >> >>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
> >> >>>>>>>         xmlns:camel="http://camel.apache.org/schema/spring"
> >> >>>>>>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> >>>>>>>         xsi:schemaLocation="
> >> >>>> http://www.springframework.org/schema/beans
> >> >>>>>>>
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> >> >>>>>>>         http://camel.apache.org/schema/spring
> >> >>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd">
> >> >>>>>>>
> >> >>>>>>>    <camelContext trace="false" xmlns="
> >> >>>>>> http://camel.apache.org/schema/spring
> >> >>>>>>> ">
> >> >>>>>>>      <route id="simple">
> >> >>>>>>>
> >> >>>>>>>                   <from
> >> >> uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> >> >>>>>>>               <log message="Moving message to Folder"/>
> >> >>>>>>>          <to uri="file:C:\Data\FuseJars\messages"/>
> >> >>>>>>>      </route>
> >> >>>>>>> </camelContext>
> >> >>>>>>>
> >> >>>>>>> </beans>
> >> >>>>>>>
> >> >>>>>>> The simple file transfer works, but when i added the scheduling
> >> >>> part
> >> >>>> am
> >> >>>>>>> getting the following error.
> >> >>>>>>> Any help will be highly appreciated.
> >> >>>>>>>
> >> >>>>>>> [artzScheduler-camel-1_Worker-5] QuartzEndpoint
> >> >>>> ERROR
> >> >>>>>> Error
> >> >>>>>>> processing exchange. Exchange[Message: [Body is null]]. Caused
> >> >> by:
> >> >>>>>>> [org.quartz.JobExecutionException -
> >> >>>>>>>
> >> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
> >> >>>>>> Cannot
> >> >>>>>>> write null body to file:
> >> >>>>>>>
> >> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> >> >>>>>>> [artzScheduler-camel-1_Worker-5] JobRunShell
> >> >>>   INFO
> >> >>>>>>   Job
> >> >>>>>>> DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> >> >>>>>>> org.quartz.JobExecutionException:
> >> >>>>>>>
> >> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
> >> >>>>>> Cannot
> >> >>>>>>> write null body to file:
> >> >>>>>>>
> >> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
> >> >>>> [See
> >> >>>>>>> nested exception:
> >> >>>>>>>
> >> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
> >> >>>>>> Cannot
> >> >>>>>>> write null body to file:
> >> >>>>>>>
> >> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> >> >>>>>>>          at
> >> >>>>>>>
> >> >>>>>>>
> >> >>
> >>
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
> >>
> >> >>
> >> >>>>>>>          at
> >> >>>>>>>
> >> >>>>>>>
> >> >>
> >>
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
> >>
> >> >>
> >> >>>>>>>          at
> >> >>>>>>>
> >> >>>
> >> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> >> >>>>>>>          at
> >> >>>>>>>
> >> >>>>>>>
> >> >>
> >>
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
> >>
> >> >>
> >> >>>>>>> [artzScheduler-camel-1_Worker-6] simple
> >> >>> INFO
> >> >>>>>>>   Moving
> >> >>>>>>> message to Folder
> >> >>>>>>> [
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>>
> >> >>>>>>> --
> >> >>>>>>> View this message in context:
> >> >>>>>>>
> >> >>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> >> >>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >>>>>>>
> >> >>>>>>
> >> >>>>>> ------------------------------
> >> >>>>>>   If you reply to this email, your message will be added to the
> >> >>>> discussion
> >> >>>>>> below:
> >> >>>>>>
> >> >>>>>>
> >> >>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
> >> >>>>>>   To unsubscribe from Cannot write null body to file error !,
> >> click
> >> >>>> here<
> >> >>>>>
> >> >>>>>> .
> >> >>>>>> NAML<
> >> >>
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >> >>>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>>
> >> >>>>> --
> >> >>>>> View this message in context:
> >> >>>>>
> >> >>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
> >> >>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >>>>>
> >> >>>>
> >> >>>> ------------------------------
> >> >>>>   If you reply to this email, your message will be added to the
> >> >> discussion
> >> >>>> below:
> >> >>>>
> >> >>>>
> >> >>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
> >> >>
> >> >>>>   To unsubscribe from Cannot write null body to file error !, click
> >> >> here<
> >> >>>
> >> >>>> .
> >> >>>> NAML<
> >> >>
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >> >>>>
> >> >>>
> >> >>> camelContext.xml (1K) <
> >> >>>
> >> http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml
> >
> >> >>> message2.xml (286 bytes) <
> >> >>> http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml
> >
> >> >>>
> >> >>>
> >> >>>
> >> >>>
> >> >>> --
> >> >>> View this message in context:
> >> >>>
> >> >>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
> >> >>
> >> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
> >> >>>
> >> >>
> >> >> ------------------------------
> >> >>   If you reply to this email, your message will be added to the
> >> discussion
> >> >> below:
> >> >>
> >> >>
> >>
> >> >> .
> >> >> NAML<
> >>
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729760.html
> >>
> >> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >>
> >>
> >>
> >> ------------------------------
> >>  If you reply to this email, your message will be added to the
> >> discussion below:
> >>
> >>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729766.html
> >>  To unsubscribe from Cannot write null body to file error !, click here<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=
> >
> >> .
> >> NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >>
> >
> >
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729804.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by bru1900 <ra...@gmail.com>.
Am sorry, that worked just as i was looking for !
Thank you so much Christain and Marco.


On Mon, Mar 25, 2013 at 3:57 PM, Remya Nambiar <ra...@gmail.com> wrote:

> Marco,
>
> Thank you for these references. I have tried the first option you
> suggested before hand.
> Am trying to incorporate quartz scheduling into the similar way.
>
> I need to design a route, which moves file from a source directory to
> target directory, following a cron schedule.
>
> In the (2) option, a new file gets created with contents of the text file,
> but i need the actual file to be moved, like it would happen in option (1).
>
>
>
> On Mon, Mar 25, 2013 at 11:12 AM, Marco Westermann [via Camel] <
> ml-node+s465427n5729766h84@n5.nabble.com> wrote:
>
>> Hi,
>>
>> first you need a basic understanding of the route parts (endpoints) you
>> are using. If I understand you correct you have files in your source
>> directory which you want to move to a destination directory at a given
>> time?! Then you have three alternatives how to archive this.
>>
>> 1.
>> poll a directory with the file consumer  endpoint
>>
>> <from uri="file://src/data"/>
>>
>> <to uri="file:C:\Data\FuseJars\messages"/>
>>
>>
>> That would move all files which appears in the src folder to the
>> messages folder. If you now want to move the files on a specified time,
>> you can only start the route at that time. For that have a look at:
>> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>>
>>
>> 2. Your problem is, that the body of the message has to contain the file
>> content you want to move. The quartz consumer endpoint you use just
>> sends out an empty body like Christian already explained.
>> To set the content of the messagebody to the filecontent you can use a
>> pollenrich. Have a look here:
>> http://camel.apache.org/content-enricher.html
>>
>> then your route would look similar to:
>>
>> <from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
>>    <log message="Writing message to Folder"/>
>>    <pollEnrich uri="file://src/data?fileName=data.txt"/>
>>    <to uri="file:C:\Data\FuseJars\messages"/>
>>
>> 3. Use a java bean which moves the files with pure java code
>>
>> <from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
>>
>>      <to uri="bean:fileMover"/>
>>
>> For how to use beans in camel have a look here:
>> http://camel.apache.org/bean.html
>>
>> I hope this helps understanding how camel works. I also can recommend
>> the book "camel in action" which gives a good overview of how camel
>> works and dives you into the different aspects of using camel.
>>
>> regards, Marco
>>
>>
>>
>>
>> Am 25.03.2013 15:34, schrieb bru1900:
>>
>> > Christian,
>> >
>> > So in this case, a new file is being written into the target folder
>> with
>> > the Content "Camel Rocks".
>> >
>> > But am looking to move a file from the source folder to the
>> destination...
>> > how can i do that? using quartz schedule !
>> >
>> > Thank you,
>> > Remya
>> >
>> >
>> > On Fri, Mar 22, 2013 at 5:56 PM, Christian Mueller [via Camel] <
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729766&i=0>>
>> wrote:
>> >
>> >> <route id="simple">
>> >>    <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
>> >>    <log message="Writing message to Folder"/>
>> >>    <setBody><constant>Camel rocks</constant></setBody>
>> >>    <to uri="file:C:\Data\FuseJars\messages"/>
>> >> </route>
>> >>
>> >> Best,
>> >> Christian
>> >>
>> >> On Fri, Mar 22, 2013 at 10:15 PM, bru1900 <[hidden email]<
>> http://user/SendEmail.jtp?type=node&node=5729705&i=0>>
>> >> wrote:
>> >>
>> >>> Am sorry about my lack of understanding.
>> >>>
>> >>> But by adding <setBody><constant>Camel rocks</constant></setBody> to
>> the
>> >>> file endpoint you mean? which file?
>> >>>
>> >>> This is my context file(that am executing) and the other is my msg
>> file
>> >> (
>> >>> present in src/data)
>> >>>
>> >>>
>> >>> On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
>> >>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5729705&i=1>>
>>
>> >> wrote:
>> >>>> By using "quartz://src/data" it looks like you want route messages
>> >> from
>> >>>> the
>> >>>> src/data folder. But in this case "src" is the timer group name and
>> >>> "data"
>> >>>> is the timer name.
>> >>>> And the quartz component sends an empty message (with a null body).
>> >>> That's
>> >>>> what the file component complians. If you add something like:
>> >>>> <setBody><constant>Camel rocks</constant></setBody>
>> >>>>
>> >>>> before your file endpoint, it should work...
>> >>>>
>> >>>> Best,
>> >>>> Christian
>> >>>>
>> >>>> On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<
>> >>> http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
>> >>>> wrote:
>> >>>>
>> >>>>> I did look at these documents, in one of the examples, the
>> suggested
>> >>> was
>> >>>>> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
>> >>>>>
>> >>>>> i am trying to do a similar thing in xml configuration. Where am i
>> >>> going
>> >>>>> wrong?
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
>> >>>>> [hidden email] <
>> http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
>> >>>> wrote:
>> >>>>>> Your Quartz URI is not valid. You can read more about it at [1].
>> >>>>>> I think you are looking for the cron scheduled route policy [2].
>> >>>>>>
>> >>>>>> [1] http://camel.apache.org/quartz.html
>> >>>>>> [2] http://camel.apache.org/cronscheduledroutepolicy.html
>> >>>>>>
>> >>>>>> Best,
>> >>>>>> Christian
>> >>>>>>
>> >>>>>> On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
>> >>>>> http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
>> >>>>>> wrote:
>> >>>>>>
>> >>>>>>> I am newly learning how to set up routes in camel, and Quartz
>> >>>> schedule
>> >>>>>>> them.
>> >>>>>>>
>> >>>>>>> I wrote a simple xml config,
>> >>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>> >>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>> >>>>>>>         xmlns:camel="http://camel.apache.org/schema/spring"
>> >>>>>>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> >>>>>>>         xsi:schemaLocation="
>> >>>> http://www.springframework.org/schema/beans
>> >>>>>>> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>> >>>>>>>         http://camel.apache.org/schema/spring
>> >>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd">
>> >>>>>>>
>> >>>>>>>    <camelContext trace="false" xmlns="
>> >>>>>> http://camel.apache.org/schema/spring
>> >>>>>>> ">
>> >>>>>>>      <route id="simple">
>> >>>>>>>
>> >>>>>>>                   <from
>> >> uri="quartz://src/data?cron=0+16+*+*+*+?"/>
>> >>>>>>>               <log message="Moving message to Folder"/>
>> >>>>>>>          <to uri="file:C:\Data\FuseJars\messages"/>
>> >>>>>>>      </route>
>> >>>>>>> </camelContext>
>> >>>>>>>
>> >>>>>>> </beans>
>> >>>>>>>
>> >>>>>>> The simple file transfer works, but when i added the scheduling
>> >>> part
>> >>>> am
>> >>>>>>> getting the following error.
>> >>>>>>> Any help will be highly appreciated.
>> >>>>>>>
>> >>>>>>> [artzScheduler-camel-1_Worker-5] QuartzEndpoint
>> >>>> ERROR
>> >>>>>> Error
>> >>>>>>> processing exchange. Exchange[Message: [Body is null]]. Caused
>> >> by:
>> >>>>>>> [org.quartz.JobExecutionException -
>> >>>>>>>
>> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
>> >>>>>> Cannot
>> >>>>>>> write null body to file:
>> >>>>>>>
>> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
>> >>>>>>> [artzScheduler-camel-1_Worker-5] JobRunShell
>> >>>   INFO
>> >>>>>>   Job
>> >>>>>>> DEFAULT.quartz-endpoint1 threw a JobExecutionException:
>> >>>>>>> org.quartz.JobExecutionException:
>> >>>>>>>
>> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
>> >>>>>> Cannot
>> >>>>>>> write null body to file:
>> >>>>>>>
>> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
>> >>>> [See
>> >>>>>>> nested exception:
>> >>>>>>>
>> >>> org.apache.camel.component.file.GenericFileOperationFailedException:
>> >>>>>> Cannot
>> >>>>>>> write null body to file:
>> >>>>>>>
>> >> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
>> >>>>>>>          at
>> >>>>>>>
>> >>>>>>>
>> >>
>> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>>
>> >>
>> >>>>>>>          at
>> >>>>>>>
>> >>>>>>>
>> >>
>> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>>
>> >>
>> >>>>>>>          at
>> >>>>>>>
>> >>>
>> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
>> >>>>>>>          at
>> >>>>>>>
>> >>>>>>>
>> >>
>> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
>>
>> >>
>> >>>>>>> [artzScheduler-camel-1_Worker-6] simple
>> >>> INFO
>> >>>>>>>   Moving
>> >>>>>>> message to Folder
>> >>>>>>> [
>> >>>>>>>
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> --
>> >>>>>>> View this message in context:
>> >>>>>>>
>> >>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
>> >>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>>>>>>
>> >>>>>>
>> >>>>>> ------------------------------
>> >>>>>>   If you reply to this email, your message will be added to the
>> >>>> discussion
>> >>>>>> below:
>> >>>>>>
>> >>>>>>
>> >>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
>> >>>>>>   To unsubscribe from Cannot write null body to file error !,
>> click
>> >>>> here<
>> >>>>>
>> >>>>>> .
>> >>>>>> NAML<
>> >>
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >>>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> View this message in context:
>> >>>>>
>> >>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
>> >>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>>>>
>> >>>>
>> >>>> ------------------------------
>> >>>>   If you reply to this email, your message will be added to the
>> >> discussion
>> >>>> below:
>> >>>>
>> >>>>
>> >>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
>> >>
>> >>>>   To unsubscribe from Cannot write null body to file error !, click
>> >> here<
>> >>>
>> >>>> .
>> >>>> NAML<
>> >>
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>> >>>>
>> >>>
>> >>> camelContext.xml (1K) <
>> >>>
>> http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml>
>> >>> message2.xml (286 bytes) <
>> >>> http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml>
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> View this message in context:
>> >>>
>> >>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
>> >>
>> >>> Sent from the Camel - Users mailing list archive at Nabble.com.
>> >>>
>> >>
>> >> ------------------------------
>> >>   If you reply to this email, your message will be added to the
>> discussion
>> >> below:
>> >>
>> >>
>>
>> >> .
>> >> NAML<
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>> >>
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729760.html
>>
>> > Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729766.html
>>  To unsubscribe from Cannot write null body to file error !, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729804.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by Marco Westermann <Ma...@gmx.de>.
Hi,

first you need a basic understanding of the route parts (endpoints) you 
are using. If I understand you correct you have files in your source 
directory which you want to move to a destination directory at a given 
time?! Then you have three alternatives how to archive this.

1.
poll a directory with the file consumer  endpoint

<from uri="file://src/data"/>

<to uri="file:C:\Data\FuseJars\messages"/>


That would move all files which appears in the src folder to the 
messages folder. If you now want to move the files on a specified time, 
you can only start the route at that time. For that have a look at: 
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html


2. Your problem is, that the body of the message has to contain the file 
content you want to move. The quartz consumer endpoint you use just 
sends out an empty body like Christian already explained.
To set the content of the messagebody to the filecontent you can use a 
pollenrich. Have a look here: http://camel.apache.org/content-enricher.html

then your route would look similar to:

<from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>
   <log message="Writing message to Folder"/>
   <pollEnrich uri="file://src/data?fileName=data.txt"/>
   <to uri="file:C:\Data\FuseJars\messages"/>

3. Use a java bean which moves the files with pure java code

<from uri="quartz://myQuarzJob?cron=0+16+*+*+*+?"/>

     <to uri="bean:fileMover"/>

For how to use beans in camel have a look here: 
http://camel.apache.org/bean.html

I hope this helps understanding how camel works. I also can recommend 
the book "camel in action" which gives a good overview of how camel 
works and dives you into the different aspects of using camel.

regards, Marco




Am 25.03.2013 15:34, schrieb bru1900:
> Christian,
>
> So in this case, a new file is being written into the target folder with
> the Content "Camel Rocks".
>
> But am looking to move a file from the source folder to the destination...
> how can i do that? using quartz schedule !
>
> Thank you,
> Remya
>
>
> On Fri, Mar 22, 2013 at 5:56 PM, Christian Mueller [via Camel] <
> ml-node+s465427n5729705h93@n5.nabble.com> wrote:
>
>> <route id="simple">
>>    <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
>>    <log message="Writing message to Folder"/>
>>    <setBody><constant>Camel rocks</constant></setBody>
>>    <to uri="file:C:\Data\FuseJars\messages"/>
>> </route>
>>
>> Best,
>> Christian
>>
>> On Fri, Mar 22, 2013 at 10:15 PM, bru1900 <[hidden email]<http://user/SendEmail.jtp?type=node&node=5729705&i=0>>
>> wrote:
>>
>>> Am sorry about my lack of understanding.
>>>
>>> But by adding <setBody><constant>Camel rocks</constant></setBody> to the
>>> file endpoint you mean? which file?
>>>
>>> This is my context file(that am executing) and the other is my msg file
>> (
>>> present in src/data)
>>>
>>>
>>> On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5729705&i=1>>
>> wrote:
>>>> By using "quartz://src/data" it looks like you want route messages
>> from
>>>> the
>>>> src/data folder. But in this case "src" is the timer group name and
>>> "data"
>>>> is the timer name.
>>>> And the quartz component sends an empty message (with a null body).
>>> That's
>>>> what the file component complians. If you add something like:
>>>> <setBody><constant>Camel rocks</constant></setBody>
>>>>
>>>> before your file endpoint, it should work...
>>>>
>>>> Best,
>>>> Christian
>>>>
>>>> On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<
>>> http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
>>>> wrote:
>>>>
>>>>> I did look at these documents, in one of the examples, the suggested
>>> was
>>>>> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
>>>>>
>>>>> i am trying to do a similar thing in xml configuration. Where am i
>>> going
>>>>> wrong?
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
>>>>> [hidden email] <http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
>>>> wrote:
>>>>>> Your Quartz URI is not valid. You can read more about it at [1].
>>>>>> I think you are looking for the cron scheduled route policy [2].
>>>>>>
>>>>>> [1] http://camel.apache.org/quartz.html
>>>>>> [2] http://camel.apache.org/cronscheduledroutepolicy.html
>>>>>>
>>>>>> Best,
>>>>>> Christian
>>>>>>
>>>>>> On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
>>>>> http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
>>>>>> wrote:
>>>>>>
>>>>>>> I am newly learning how to set up routes in camel, and Quartz
>>>> schedule
>>>>>>> them.
>>>>>>>
>>>>>>> I wrote a simple xml config,
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <beans xmlns="http://www.springframework.org/schema/beans"
>>>>>>>         xmlns:camel="http://camel.apache.org/schema/spring"
>>>>>>>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>>>>>         xsi:schemaLocation="
>>>> http://www.springframework.org/schema/beans
>>>>>>> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>>>>>>>         http://camel.apache.org/schema/spring
>>>>>>> http://camel.apache.org/schema/spring/camel-spring.xsd">
>>>>>>>
>>>>>>>    <camelContext trace="false" xmlns="
>>>>>> http://camel.apache.org/schema/spring
>>>>>>> ">
>>>>>>>      <route id="simple">
>>>>>>>
>>>>>>>                   <from
>> uri="quartz://src/data?cron=0+16+*+*+*+?"/>
>>>>>>>               <log message="Moving message to Folder"/>
>>>>>>>          <to uri="file:C:\Data\FuseJars\messages"/>
>>>>>>>      </route>
>>>>>>> </camelContext>
>>>>>>>
>>>>>>> </beans>
>>>>>>>
>>>>>>> The simple file transfer works, but when i added the scheduling
>>> part
>>>> am
>>>>>>> getting the following error.
>>>>>>> Any help will be highly appreciated.
>>>>>>>
>>>>>>> [artzScheduler-camel-1_Worker-5] QuartzEndpoint
>>>> ERROR
>>>>>> Error
>>>>>>> processing exchange. Exchange[Message: [Body is null]]. Caused
>> by:
>>>>>>> [org.quartz.JobExecutionException -
>>>>>>>
>>> org.apache.camel.component.file.GenericFileOperationFailedException:
>>>>>> Cannot
>>>>>>> write null body to file:
>>>>>>>
>> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
>>>>>>> [artzScheduler-camel-1_Worker-5] JobRunShell
>>>   INFO
>>>>>>   Job
>>>>>>> DEFAULT.quartz-endpoint1 threw a JobExecutionException:
>>>>>>> org.quartz.JobExecutionException:
>>>>>>>
>>> org.apache.camel.component.file.GenericFileOperationFailedException:
>>>>>> Cannot
>>>>>>> write null body to file:
>>>>>>>
>> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
>>>> [See
>>>>>>> nested exception:
>>>>>>>
>>> org.apache.camel.component.file.GenericFileOperationFailedException:
>>>>>> Cannot
>>>>>>> write null body to file:
>>>>>>>
>> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
>>>>>>>          at
>>>>>>>
>>>>>>>
>> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>>
>>>>>>>          at
>>>>>>>
>>>>>>>
>> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>>
>>>>>>>          at
>>>>>>>
>>> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
>>>>>>>          at
>>>>>>>
>>>>>>>
>> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
>>
>>>>>>> [artzScheduler-camel-1_Worker-6] simple
>>> INFO
>>>>>>>   Moving
>>>>>>> message to Folder
>>>>>>> [
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>> ------------------------------
>>>>>>   If you reply to this email, your message will be added to the
>>>> discussion
>>>>>> below:
>>>>>>
>>>>>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
>>>>>>   To unsubscribe from Cannot write null body to file error !, click
>>>> here<
>>>>>
>>>>>> .
>>>>>> NAML<
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>
>>>> ------------------------------
>>>>   If you reply to this email, your message will be added to the
>> discussion
>>>> below:
>>>>
>>>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
>>
>>>>   To unsubscribe from Cannot write null body to file error !, click
>> here<
>>>
>>>> .
>>>> NAML<
>> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>>>>
>>>
>>> camelContext.xml (1K) <
>>> http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml>
>>> message2.xml (286 bytes) <
>>> http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
>>
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>> ------------------------------
>>   If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729705.html
>>   To unsubscribe from Cannot write null body to file error !, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=>
>> .
>> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729760.html
> Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cannot write null body to file error !

Posted by bru1900 <ra...@gmail.com>.
Christian,

So in this case, a new file is being written into the target folder with
the Content "Camel Rocks".

But am looking to move a file from the source folder to the destination...
how can i do that? using quartz schedule !

Thank you,
Remya


On Fri, Mar 22, 2013 at 5:56 PM, Christian Mueller [via Camel] <
ml-node+s465427n5729705h93@n5.nabble.com> wrote:

> <route id="simple">
>   <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
>   <log message="Writing message to Folder"/>
>   <setBody><constant>Camel rocks</constant></setBody>
>   <to uri="file:C:\Data\FuseJars\messages"/>
> </route>
>
> Best,
> Christian
>
> On Fri, Mar 22, 2013 at 10:15 PM, bru1900 <[hidden email]<http://user/SendEmail.jtp?type=node&node=5729705&i=0>>
> wrote:
>
> > Am sorry about my lack of understanding.
> >
> > But by adding <setBody><constant>Camel rocks</constant></setBody> to the
> > file endpoint you mean? which file?
> >
> > This is my context file(that am executing) and the other is my msg file
> (
> > present in src/data)
> >
> >
> > On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729705&i=1>>
> wrote:
> >
> > > By using "quartz://src/data" it looks like you want route messages
> from
> > > the
> > > src/data folder. But in this case "src" is the timer group name and
> > "data"
> > > is the timer name.
> > > And the quartz component sends an empty message (with a null body).
> > That's
> > > what the file component complians. If you add something like:
> > > <setBody><constant>Camel rocks</constant></setBody>
> > >
> > > before your file endpoint, it should work...
> > >
> > > Best,
> > > Christian
> > >
> > > On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
> > > wrote:
> > >
> > > > I did look at these documents, in one of the examples, the suggested
> > was
> > > >
> > > > from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
> > > >
> > > > i am trying to do a similar thing in xml configuration. Where am i
> > going
> > > > wrong?
> > > >
> > > >
> > > >
> > > > On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
> > > > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
>
> > > wrote:
> > > >
> > > > > Your Quartz URI is not valid. You can read more about it at [1].
> > > > > I think you are looking for the cron scheduled route policy [2].
> > > > >
> > > > > [1] http://camel.apache.org/quartz.html
> > > > > [2] http://camel.apache.org/cronscheduledroutepolicy.html
> > > > >
> > > > > Best,
> > > > > Christian
> > > > >
> > > > > On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
> > > > http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> > > > > wrote:
> > > > >
> > > > > > I am newly learning how to set up routes in camel, and Quartz
> > > schedule
> > > > > > them.
> > > > > >
> > > > > > I wrote a simple xml config,
> > > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > > <beans xmlns="http://www.springframework.org/schema/beans"
> > > > > >        xmlns:camel="http://camel.apache.org/schema/spring"
> > > > > >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > > >        xsi:schemaLocation="
> > > http://www.springframework.org/schema/beans
> > > > > > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> > > > > >        http://camel.apache.org/schema/spring
> > > > > > http://camel.apache.org/schema/spring/camel-spring.xsd">
> > > > > >
> > > > > >   <camelContext trace="false" xmlns="
> > > > > http://camel.apache.org/schema/spring
> > > > > > ">
> > > > > >     <route id="simple">
> > > > > >
> > > > > >                  <from
> uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> > > > > >              <log message="Moving message to Folder"/>
> > > > > >         <to uri="file:C:\Data\FuseJars\messages"/>
> > > > > >     </route>
> > > > > > </camelContext>
> > > > > >
> > > > > > </beans>
> > > > > >
> > > > > > The simple file transfer works, but when i added the scheduling
> > part
> > > am
> > > > > > getting the following error.
> > > > > > Any help will be highly appreciated.
> > > > > >
> > > > > > [artzScheduler-camel-1_Worker-5] QuartzEndpoint
> > > ERROR
> > > > > Error
> > > > > > processing exchange. Exchange[Message: [Body is null]]. Caused
> by:
> > > > > > [org.quartz.JobExecutionException -
> > > > > >
> > org.apache.camel.component.file.GenericFileOperationFailedException:
> > > > > Cannot
> > > > > > write null body to file:
> > > > > >
> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > > > > [artzScheduler-camel-1_Worker-5] JobRunShell
> >  INFO
> > > > >  Job
> > > > > > DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> > > > > > org.quartz.JobExecutionException:
> > > > > >
> > org.apache.camel.component.file.GenericFileOperationFailedException:
> > > > > Cannot
> > > > > > write null body to file:
> > > > > >
> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
> > > [See
> > > > > > nested exception:
> > > > > >
> > org.apache.camel.component.file.GenericFileOperationFailedException:
> > > > > Cannot
> > > > > > write null body to file:
> > > > > >
> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > > > >         at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> > >
> > > > >
> > > > > >         at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> > >
> > > > >
> > > > > >         at
> > > > > >
> > > >
> > org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> > > > > >         at
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
>
> > >
> > > > >
> > > > > > [artzScheduler-camel-1_Worker-6] simple
> > INFO
> > > > > >  Moving
> > > > > > message to Folder
> > > > > > [
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > View this message in context:
> > > > > >
> > > > >
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> > > > > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > > > > >
> > > > >
> > > > >
> > > > > ------------------------------
> > > > >  If you reply to this email, your message will be added to the
> > > discussion
> > > > > below:
> > > > >
> > > > >
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
> > > > >  To unsubscribe from Cannot write null body to file error !, click
> > > here<
> > > >
> > > >
> > > > > .
> > > > > NAML<
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
> > >
> > > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > > >
> > >
> > >
> > > ------------------------------
> > >  If you reply to this email, your message will be added to the
> discussion
> > > below:
> > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
>
> > >  To unsubscribe from Cannot write null body to file error !, click
> here<
> >
> >
> > > .
> > > NAML<
> >
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> > >
> > >
> >
> >
> > camelContext.xml (1K) <
> > http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml>
>
> > message2.xml (286 bytes) <
> > http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml>
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729705.html
>  To unsubscribe from Cannot write null body to file error !, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729760.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by Christian Müller <ch...@gmail.com>.
<route id="simple">
  <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
  <log message="Writing message to Folder"/>
  <setBody><constant>Camel rocks</constant></setBody>
  <to uri="file:C:\Data\FuseJars\messages"/>
</route>

Best,
Christian

On Fri, Mar 22, 2013 at 10:15 PM, bru1900 <ra...@gmail.com> wrote:

> Am sorry about my lack of understanding.
>
> But by adding <setBody><constant>Camel rocks</constant></setBody> to the
> file endpoint you mean? which file?
>
> This is my context file(that am executing) and the other is my msg file (
> present in src/data)
>
>
> On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
> ml-node+s465427n5729701h69@n5.nabble.com> wrote:
>
> > By using "quartz://src/data" it looks like you want route messages from
> > the
> > src/data folder. But in this case "src" is the timer group name and
> "data"
> > is the timer name.
> > And the quartz component sends an empty message (with a null body).
> That's
> > what the file component complians. If you add something like:
> > <setBody><constant>Camel rocks</constant></setBody>
> >
> > before your file endpoint, it should work...
> >
> > Best,
> > Christian
> >
> > On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
> > wrote:
> >
> > > I did look at these documents, in one of the examples, the suggested
> was
> > >
> > > from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
> > >
> > > i am trying to do a similar thing in xml configuration. Where am i
> going
> > > wrong?
> > >
> > >
> > >
> > > On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
> > > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
> > wrote:
> > >
> > > > Your Quartz URI is not valid. You can read more about it at [1].
> > > > I think you are looking for the cron scheduled route policy [2].
> > > >
> > > > [1] http://camel.apache.org/quartz.html
> > > > [2] http://camel.apache.org/cronscheduledroutepolicy.html
> > > >
> > > > Best,
> > > > Christian
> > > >
> > > > On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
> > > http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> > > > wrote:
> > > >
> > > > > I am newly learning how to set up routes in camel, and Quartz
> > schedule
> > > > > them.
> > > > >
> > > > > I wrote a simple xml config,
> > > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > > <beans xmlns="http://www.springframework.org/schema/beans"
> > > > >        xmlns:camel="http://camel.apache.org/schema/spring"
> > > > >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > > >        xsi:schemaLocation="
> > http://www.springframework.org/schema/beans
> > > > > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> > > > >        http://camel.apache.org/schema/spring
> > > > > http://camel.apache.org/schema/spring/camel-spring.xsd">
> > > > >
> > > > >   <camelContext trace="false" xmlns="
> > > > http://camel.apache.org/schema/spring
> > > > > ">
> > > > >     <route id="simple">
> > > > >
> > > > >                  <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> > > > >              <log message="Moving message to Folder"/>
> > > > >         <to uri="file:C:\Data\FuseJars\messages"/>
> > > > >     </route>
> > > > > </camelContext>
> > > > >
> > > > > </beans>
> > > > >
> > > > > The simple file transfer works, but when i added the scheduling
> part
> > am
> > > > > getting the following error.
> > > > > Any help will be highly appreciated.
> > > > >
> > > > > [artzScheduler-camel-1_Worker-5] QuartzEndpoint
> > ERROR
> > > > Error
> > > > > processing exchange. Exchange[Message: [Body is null]]. Caused by:
> > > > > [org.quartz.JobExecutionException -
> > > > >
> org.apache.camel.component.file.GenericFileOperationFailedException:
> > > > Cannot
> > > > > write null body to file:
> > > > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > > > [artzScheduler-camel-1_Worker-5] JobRunShell
>  INFO
> > > >  Job
> > > > > DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> > > > > org.quartz.JobExecutionException:
> > > > >
> org.apache.camel.component.file.GenericFileOperationFailedException:
> > > > Cannot
> > > > > write null body to file:
> > > > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
> > [See
> > > > > nested exception:
> > > > >
> org.apache.camel.component.file.GenericFileOperationFailedException:
> > > > Cannot
> > > > > write null body to file:
> > > > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > > >         at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
> >
> > > >
> > > > >         at
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
> >
> > > >
> > > > >         at
> > > > >
> > >
> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> > > > >         at
> > > > >
> > > > >
> > > >
> > >
> >
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
> >
> > > >
> > > > > [artzScheduler-camel-1_Worker-6] simple
> INFO
> > > > >  Moving
> > > > > message to Folder
> > > > > [
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> > > > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > > > >
> > > >
> > > >
> > > > ------------------------------
> > > >  If you reply to this email, your message will be added to the
> > discussion
> > > > below:
> > > >
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
> > > >  To unsubscribe from Cannot write null body to file error !, click
> > here<
> > >
> > >
> > > > .
> > > > NAML<
> > >
> >
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
> >
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
> >  To unsubscribe from Cannot write null body to file error !, click here<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=
> >
> > .
> > NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
> camelContext.xml (1K) <
> http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml>
> message2.xml (286 bytes) <
> http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Cannot write null body to file error !

Posted by bru1900 <ra...@gmail.com>.
Am sorry about my lack of understanding.

But by adding <setBody><constant>Camel rocks</constant></setBody> to the
file endpoint you mean? which file?

This is my context file(that am executing) and the other is my msg file (
present in src/data)


On Fri, Mar 22, 2013 at 5:07 PM, Christian Mueller [via Camel] <
ml-node+s465427n5729701h69@n5.nabble.com> wrote:

> By using "quartz://src/data" it looks like you want route messages from
> the
> src/data folder. But in this case "src" is the timer group name and "data"
> is the timer name.
> And the quartz component sends an empty message (with a null body). That's
> what the file component complians. If you add something like:
> <setBody><constant>Camel rocks</constant></setBody>
>
> before your file endpoint, it should work...
>
> Best,
> Christian
>
> On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <[hidden email]<http://user/SendEmail.jtp?type=node&node=5729701&i=0>>
> wrote:
>
> > I did look at these documents, in one of the examples, the suggested was
> >
> > from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
> >
> > i am trying to do a similar thing in xml configuration. Where am i going
> > wrong?
> >
> >
> >
> > On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=5729701&i=1>>
> wrote:
> >
> > > Your Quartz URI is not valid. You can read more about it at [1].
> > > I think you are looking for the cron scheduled route policy [2].
> > >
> > > [1] http://camel.apache.org/quartz.html
> > > [2] http://camel.apache.org/cronscheduledroutepolicy.html
> > >
> > > Best,
> > > Christian
> > >
> > > On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
> > http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> > > wrote:
> > >
> > > > I am newly learning how to set up routes in camel, and Quartz
> schedule
> > > > them.
> > > >
> > > > I wrote a simple xml config,
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <beans xmlns="http://www.springframework.org/schema/beans"
> > > >        xmlns:camel="http://camel.apache.org/schema/spring"
> > > >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >        xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> > > > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> > > >        http://camel.apache.org/schema/spring
> > > > http://camel.apache.org/schema/spring/camel-spring.xsd">
> > > >
> > > >   <camelContext trace="false" xmlns="
> > > http://camel.apache.org/schema/spring
> > > > ">
> > > >     <route id="simple">
> > > >
> > > >                  <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> > > >              <log message="Moving message to Folder"/>
> > > >         <to uri="file:C:\Data\FuseJars\messages"/>
> > > >     </route>
> > > > </camelContext>
> > > >
> > > > </beans>
> > > >
> > > > The simple file transfer works, but when i added the scheduling part
> am
> > > > getting the following error.
> > > > Any help will be highly appreciated.
> > > >
> > > > [artzScheduler-camel-1_Worker-5] QuartzEndpoint
> ERROR
> > > Error
> > > > processing exchange. Exchange[Message: [Body is null]]. Caused by:
> > > > [org.quartz.JobExecutionException -
> > > > org.apache.camel.component.file.GenericFileOperationFailedException:
> > > Cannot
> > > > write null body to file:
> > > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > > [artzScheduler-camel-1_Worker-5] JobRunShell                    INFO
> > >  Job
> > > > DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> > > > org.quartz.JobExecutionException:
> > > > org.apache.camel.component.file.GenericFileOperationFailedException:
> > > Cannot
> > > > write null body to file:
> > > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29
> [See
> > > > nested exception:
> > > > org.apache.camel.component.file.GenericFileOperationFailedException:
> > > Cannot
> > > > write null body to file:
> > > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > >         at
> > > >
> > > >
> > >
> >
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> > >
> > > >         at
> > > >
> > > >
> > >
> >
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> > >
> > > >         at
> > > >
> > org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> > > >         at
> > > >
> > > >
> > >
> >
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
>
> > >
> > > > [artzScheduler-camel-1_Worker-6] simple                         INFO
> > > >  Moving
> > > > message to Folder
> > > > [
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> > > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > > >
> > >
> > >
> > > ------------------------------
> > >  If you reply to this email, your message will be added to the
> discussion
> > > below:
> > >
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
> > >  To unsubscribe from Cannot write null body to file error !, click
> here<
> >
> >
> > > .
> > > NAML<
> >
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
>
> > >
> > >
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
>
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729701.html
>  To unsubscribe from Cannot write null body to file error !, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


camelContext.xml (1K) <http://camel.465427.n5.nabble.com/attachment/5729702/0/camelContext.xml>
message2.xml (286 bytes) <http://camel.465427.n5.nabble.com/attachment/5729702/1/message2.xml>




--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729702.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by Christian Müller <ch...@gmail.com>.
By using "quartz://src/data" it looks like you want route messages from the
src/data folder. But in this case "src" is the timer group name and "data"
is the timer name.
And the quartz component sends an empty message (with a null body). That's
what the file component complians. If you add something like:
<setBody><constant>Camel rocks</constant></setBody>

before your file endpoint, it should work...

Best,
Christian

On Fri, Mar 22, 2013 at 9:50 PM, bru1900 <ra...@gmail.com> wrote:

> I did look at these documents, in one of the examples, the suggested was
>
> from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").
>
> i am trying to do a similar thing in xml configuration. Where am i going
> wrong?
>
>
>
> On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
> ml-node+s465427n5729698h76@n5.nabble.com> wrote:
>
> > Your Quartz URI is not valid. You can read more about it at [1].
> > I think you are looking for the cron scheduled route policy [2].
> >
> > [1] http://camel.apache.org/quartz.html
> > [2] http://camel.apache.org/cronscheduledroutepolicy.html
> >
> > Best,
> > Christian
> >
> > On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<
> http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> > wrote:
> >
> > > I am newly learning how to set up routes in camel, and Quartz schedule
> > > them.
> > >
> > > I wrote a simple xml config,
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <beans xmlns="http://www.springframework.org/schema/beans"
> > >        xmlns:camel="http://camel.apache.org/schema/spring"
> > >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >        xsi:schemaLocation="http://www.springframework.org/schema/beans
> > > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> > >        http://camel.apache.org/schema/spring
> > > http://camel.apache.org/schema/spring/camel-spring.xsd">
> > >
> > >   <camelContext trace="false" xmlns="
> > http://camel.apache.org/schema/spring
> > > ">
> > >     <route id="simple">
> > >
> > >                  <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> > >              <log message="Moving message to Folder"/>
> > >         <to uri="file:C:\Data\FuseJars\messages"/>
> > >     </route>
> > > </camelContext>
> > >
> > > </beans>
> > >
> > > The simple file transfer works, but when i added the scheduling part am
> > > getting the following error.
> > > Any help will be highly appreciated.
> > >
> > > [artzScheduler-camel-1_Worker-5] QuartzEndpoint                 ERROR
> > Error
> > > processing exchange. Exchange[Message: [Body is null]]. Caused by:
> > > [org.quartz.JobExecutionException -
> > > org.apache.camel.component.file.GenericFileOperationFailedException:
> > Cannot
> > > write null body to file:
> > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > > [artzScheduler-camel-1_Worker-5] JobRunShell                    INFO
> >  Job
> > > DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> > > org.quartz.JobExecutionException:
> > > org.apache.camel.component.file.GenericFileOperationFailedException:
> > Cannot
> > > write null body to file:
> > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29 [See
> > > nested exception:
> > > org.apache.camel.component.file.GenericFileOperationFailedException:
> > Cannot
> > > write null body to file:
> > > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > >         at
> > >
> > >
> >
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
> >
> > >         at
> > >
> > >
> >
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
> >
> > >         at
> > >
> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> > >         at
> > >
> > >
> >
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
> >
> > > [artzScheduler-camel-1_Worker-6] simple                         INFO
> > >  Moving
> > > message to Folder
> > > [
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >
> >
> >
> > ------------------------------
> >  If you reply to this email, your message will be added to the discussion
> > below:
> >
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
> >  To unsubscribe from Cannot write null body to file error !, click here<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=
> >
> > .
> > NAML<
> http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml
> >
> >
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Cannot write null body to file error !

Posted by bru1900 <ra...@gmail.com>.
I did look at these documents, in one of the examples, the suggested was

from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").

i am trying to do a similar thing in xml configuration. Where am i going wrong?



On Fri, Mar 22, 2013 at 4:47 PM, Christian Mueller [via Camel] <
ml-node+s465427n5729698h76@n5.nabble.com> wrote:

> Your Quartz URI is not valid. You can read more about it at [1].
> I think you are looking for the cron scheduled route policy [2].
>
> [1] http://camel.apache.org/quartz.html
> [2] http://camel.apache.org/cronscheduledroutepolicy.html
>
> Best,
> Christian
>
> On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <[hidden email]<http://user/SendEmail.jtp?type=node&node=5729698&i=0>>
> wrote:
>
> > I am newly learning how to set up routes in camel, and Quartz schedule
> > them.
> >
> > I wrote a simple xml config,
> > <?xml version="1.0" encoding="UTF-8"?>
> > <beans xmlns="http://www.springframework.org/schema/beans"
> >        xmlns:camel="http://camel.apache.org/schema/spring"
> >        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >        xsi:schemaLocation="http://www.springframework.org/schema/beans
> > http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
> >        http://camel.apache.org/schema/spring
> > http://camel.apache.org/schema/spring/camel-spring.xsd">
> >
> >   <camelContext trace="false" xmlns="
> http://camel.apache.org/schema/spring
> > ">
> >     <route id="simple">
> >
> >                  <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
> >              <log message="Moving message to Folder"/>
> >         <to uri="file:C:\Data\FuseJars\messages"/>
> >     </route>
> > </camelContext>
> >
> > </beans>
> >
> > The simple file transfer works, but when i added the scheduling part am
> > getting the following error.
> > Any help will be highly appreciated.
> >
> > [artzScheduler-camel-1_Worker-5] QuartzEndpoint                 ERROR
> Error
> > processing exchange. Exchange[Message: [Body is null]]. Caused by:
> > [org.quartz.JobExecutionException -
> > org.apache.camel.component.file.GenericFileOperationFailedException:
> Cannot
> > write null body to file:
> > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> > [artzScheduler-camel-1_Worker-5] JobRunShell                    INFO
>  Job
> > DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> > org.quartz.JobExecutionException:
> > org.apache.camel.component.file.GenericFileOperationFailedException:
> Cannot
> > write null body to file:
> > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29 [See
> > nested exception:
> > org.apache.camel.component.file.GenericFileOperationFailedException:
> Cannot
> > write null body to file:
> > C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> >         at
> >
> >
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> >         at
> >
> >
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>
> >         at
> > org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
> >         at
> >
> >
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
>
> > [artzScheduler-camel-1_Worker-6] simple                         INFO
> >  Moving
> > message to Folder
> > [
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729698.html
>  To unsubscribe from Cannot write null body to file error !, click here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729696&code=cmFyZXJlbXlAZ21haWwuY29tfDU3Mjk2OTZ8LTE5Mzg3NTA5NjY=>
> .
> NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696p5729699.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Cannot write null body to file error !

Posted by Christian Müller <ch...@gmail.com>.
Your Quartz URI is not valid. You can read more about it at [1].
I think you are looking for the cron scheduled route policy [2].

[1] http://camel.apache.org/quartz.html
[2] http://camel.apache.org/cronscheduledroutepolicy.html

Best,
Christian

On Fri, Mar 22, 2013 at 8:45 PM, bru1900 <ra...@gmail.com> wrote:

> I am newly learning how to set up routes in camel, and Quartz schedule
> them.
>
> I wrote a simple xml config,
> <?xml version="1.0" encoding="UTF-8"?>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>   <camelContext trace="false" xmlns="http://camel.apache.org/schema/spring
> ">
>     <route id="simple">
>
>                  <from uri="quartz://src/data?cron=0+16+*+*+*+?"/>
>              <log message="Moving message to Folder"/>
>         <to uri="file:C:\Data\FuseJars\messages"/>
>     </route>
> </camelContext>
>
> </beans>
>
> The simple file transfer works, but when i added the scheduling part am
> getting the following error.
> Any help will be highly appreciated.
>
> [artzScheduler-camel-1_Worker-5] QuartzEndpoint                 ERROR Error
> processing exchange. Exchange[Message: [Body is null]]. Caused by:
> [org.quartz.JobExecutionException -
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> write null body to file:
> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
> [artzScheduler-camel-1_Worker-5] JobRunShell                    INFO  Job
> DEFAULT.quartz-endpoint1 threw a JobExecutionException:
> org.quartz.JobExecutionException:
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> write null body to file:
> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29 [See
> nested exception:
> org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
> write null body to file:
> C:\Data\FuseJars\messages\ID-CGL-R8Y2AEZ-64638-1363878882438-0-29]
>         at
>
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:117)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>         at
>
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:54)[camel-quartz-2.10.0.fuse-71-047.jar:2.10.0.fuse-71-047]
>         at
> org.quartz.core.JobRunShell.run(JobRunShell.java:216)[quartz-1.8.5.jar:]
>         at
>
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)[quartz-1.8.5.jar:]
> [artzScheduler-camel-1_Worker-6] simple                         INFO
>  Moving
> message to Folder
> [
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Cannot-write-null-body-to-file-error-tp5729696.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>