Hi

Yeah using Camel 1.3 you need to manually clear the headers so you
only send what the JMS spec allows (primitives and String basically)

You can do this by pushing a processer before you send it to the JMS
(there are other solutions as well) where you can clear the headers
using Java code.

from(x).process(new Processor()) {
  public void process(Exchange exchange) {
     // something like this (maybe you cant set a null)
     // and we probably dont have a clearHeaders() methods exposes
     exchange.getIn().setHeaders(null);
  }


In a later release this should happen automatically, that Camel drops
unsupported headers type when sending to JMS.


/Claus Ibsen
Apache Camel Committer
Blog: http://davsclaus.blogspot.com/



On Wed, Nov 19, 2008 at 1:32 PM, Daniel Wu <[EMAIL PROTECTED]> wrote:
>
> I'm using Camel 1.3 with Activemq 4.1.1
> Here is my stacktrace:
>
> Failed delivery for exchangeId:
> ID-crisocola.celular.intranet/56221-1227028858014/0-1939. On delivery
> attempt: 0 caught: org.springframework.jms.MessageFormatException: Only
> objectified primitive objects, String, Map and List types are allowed but
> was: Trigger 'atualizacaoCadastral.margemDistribuidores':  triggerClass:
> 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
> misfireInstruction: 0 nextFireTime: Wed Nov 19
> at
> org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:270)
>        at
> org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:172)
>        at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:450)
>        at
> org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:523)
>        at
> org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:114)
>        at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:59)
>        at
> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:155)
>        at
> org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsynProcessorBridge.process(AsyncProcessorTypeConverter.java:44)
>        at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
>        at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:53)
>        at
> org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:67)
>        at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:73)
>        at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:143)
>        at
> org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:87)
>        at
> org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:40)
>        at
> org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:44)
>        at
> org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:68)
>        at
> org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:41)
>        at
> org.apache.camel.component.quartz.QuartzEndpoint.onJobExecute(QuartzEndpoint.java:113)
>        at
> org.apache.camel.component.quartz.CamelJob.execute(CamelJob.java:32)
>        at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
>        at
> org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)
> Caused by: javax.jms.MessageFormatException: Only objectified primitive
> objects, String, Map and List types are allowed but was: Trigger
> 'atualizacaoCadastral.margemDistribuidores':  triggerClass:
> 'org.quartz.CronTrigger isVolatile: false calendar: 'null'
> misfireInstruction: 0 nextFireTime: Wed Nov 19 00:30:00 BRST 2008 type:
> class org.quartz.CronTrigger
>        at
> org.apache.activemq.command.ActiveMQMessage.checkValidObject(ActiveMQMessage.java:419)
>        at
> org.apache.activemq.command.ActiveMQMessage.setObjectProperty(ActiveMQMessage.java:387)
>        at
> org.apache.camel.component.jms.JmsBinding.appendJmsProperties(JmsBinding.java:153)
>        at
> org.apache.camel.component.jms.JmsBinding.makeJmsMessage(JmsBinding.java:117)
>        at
> org.apache.camel.component.jms.JmsProducer$2.createMessage(JmsProducer.java:116)
>        at
> org.springframework.jms.core.JmsTemplate.doSend(JmsTemplate.java:545)
>        at
> org.springframework.jms.core.JmsTemplate$4.doInJms(JmsTemplate.java:526)
>        at
> org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:447)
>
>
> Claus Ibsen-2 wrote:
>>
>> Hi Daniel
>>
>> Could you write what version of Camel you are using and what JMS
>> broker and versions you are sending the message to?
>>
>> And maybe pasting a fresh snippet of the stacktrace/error would help.
>> The original problem is nearly 1 year old.
>>
>>
>>
>> /Claus Ibsen
>> Apache Camel Committer
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>>
>> On Wed, Nov 19, 2008 at 12:51 PM, Daniel Wu <[EMAIL PROTECTED]> wrote:
>>>
>>> Hi,
>>> I'm also having these error messages with routes that start from a quartz
>>> endpoint. Is the line map.put("trigger", trigger); from the QuartzMessage
>>> class correct/necessary? I'm using
>>>
>>>
>>> Patrick Shea wrote:
>>>>
>>>> I'm using 1.2.0 with an internal activemq connection (same results when
>>>> using geronimo 2.0.2 with buitin activemq).
>>>>
>>>> I think the problem is in the QuartzMessage object, it's adding a
>>>> Trigger
>>>> object to the header.
>>>>
>>>> @Override
>>>>     protected void populateInitialHeaders(Map<String, Object> map) {
>>>>         super.populateInitialHeaders(map);
>>>>         if (jobExecutionContext != null) {
>>>>             map.put("calendar", jobExecutionContext.getCalendar());
>>>>             map.put("fireTime", jobExecutionContext.getFireTime());
>>>>             map.put("jobDetail", jobExecutionContext.getJobDetail());
>>>>             map.put("jobInstance",
>>>> jobExecutionContext.getJobInstance());
>>>>             map.put("jobRunTime", jobExecutionContext.getJobRunTime());
>>>>             map.put("mergedJobDataMap",
>>>> jobExecutionContext.getMergedJobDataMap());
>>>>             map.put("nextFireTime",
>>>> jobExecutionContext.getNextFireTime());
>>>>             map.put("previousFireTime",
>>>> jobExecutionContext.getPreviousFireTime());
>>>>             map.put("refireCount",
>>>> jobExecutionContext.getRefireCount());
>>>>             map.put("result", jobExecutionContext.getResult());
>>>>             map.put("scheduledFireTime",
>>>> jobExecutionContext.getScheduledFireTime());
>>>>             map.put("scheduler", jobExecutionContext.getScheduler());
>>>>             Trigger trigger = jobExecutionContext.getTrigger();
>>>>  --> Bad?   map.put("trigger", trigger);
>>>>             map.put("triggerName", trigger.getName());
>>>>             map.put("triggerGroup", trigger.getGroup());
>>>>         }
>>>>     }
>>>>
>>>> -----Original Message-----
>>>> From: davsclaus <[EMAIL PROTECTED]>
>>>> Sent: Sunday, January 6, 2008 2:28am
>>>> To: [email protected]
>>>> Subject: Re: From Quartz to queue
>>>>
>>>>
>>>> What version of Camel are you using and witch JMS container are you
>>>> using?
>>>>
>>>> I think in the 1.3 branch there is a fix for removing non valid header
>>>> keys
>>>> (eg. not allowed to contain (dot) . in the key name etc.) according to
>>>> the
>>>> JMS spec.
>>>>
>>>> /Claus
>>>>
>>>>
>>>>
>>>> Patrick Shea wrote:
>>>>>
>>>>> I think I found the problem, I misunderstood the concept of in/out in a
>>>>> processor, I was using the out to add my payload while the quartz
>>>>> object
>>>>> was still in the in body.
>>>>>
>>>>> But the real problem was with the in header. I had to clear the in
>>>>> header
>>>>> to make this work, somehow the header contained something that jms
>>>>> didn't
>>>>> like.
>>>>>
>>>>> Patrick
>>>>>
>>>>> -----Original Message-----
>>>>> From: davsclaus <[EMAIL PROTECTED]>
>>>>> Sent: Saturday, January 5, 2008 6:21am
>>>>> To: [email protected]
>>>>> Subject: Re: From Quartz to queue
>>>>>
>>>>>
>>>>> Patrick
>>>>>
>>>>> To get faster and better feedback I think you should show us the code
>>>>> and
>>>>> configuration that causes the problem.
>>>>>
>>>>> Maybe creating a small unit test that demonstrates the bug so the Camel
>>>>> team
>>>>> can use this when they find and fix the bug.
>>>>>
>>>>> /Claus
>>>>>
>>>>>
>>>>> Patrick Shea wrote:
>>>>>>
>>>>>> Hi, it seems that anything starting with a quartz endpoint has issues
>>>>>> going to a jms queue.
>>>>>>
>>>>>> I to have a processor to add a string payload to the out message but
>>>>>> somehow the jms message contains some quartz object that get rejected
>>>>>> by
>>>>>> the jms queue.
>>>>>>
>>>>>> I have this as an error message:
>>>>>>
>>>>>> Only objectified primitive objects, String, Map and List types are
>>>>>> allowed
>>>>>> but was: Trigger 'docs.consumer':  triggerClass:
>>>>>> 'org.quartz.CronTrigger
>>>>>> isVolatile: false calendar: 'null' misfireInstruction: 0 nextFireTime:
>>>>>> Fri
>>>>>> Jan 04 07:17:55 PST 2008 type: class org.quartz.CronTrigger
>>>>>>
>>>>>> Patrrick
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/From-Quartz-to-queue-tp14618552s22882p14633631.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/From-Quartz-to-queue-tp14618552s22882p14646017.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/From-Quartz-to-queue-tp14618552s22882p20578240.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/From-Quartz-to-queue-tp14618552s22882p20578863.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>

Reply via email to