You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Shiv <sh...@gmail.com> on 2014/05/09 12:11:38 UTC

Multiple DB inserts due to org.apache.camel.impl.DefaultMessage cannot be cast to org.apache.camel.component.jms.JmsMessage exception while using local JMS transaction

Hi,
I am using Camel 2.2.0 (pretty old version but present in a legacy
application) and my route reads data from a JMS queue and persists in DB
using JDBC component. I am getting below error in log:

2014-05-09 15:12:16,416 | ERROR | Caused by:
[org.apache.camel.RuntimeCamelException - java.lang.ClassCastException:
org.apache.camel.impl.DefaultMessage cannot be cast to
org.apache.camel.component.jms.JmsMessage] |
org.apache.camel.component.jms.EndpointMessageListener |
DefaultMessageListenerContainer-1
org.apache.camel.RuntimeCamelException: java.lang.ClassCastException:
org.apache.camel.impl.DefaultMessage cannot be cast to
org.apache.camel.component.jms.JmsMessage
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1055)

As per old posts on this forum, this issue is fixed in higher Camel
versions. But this is not causing more issues to me other than filling up
the logs, if a message comes to queue, one record is inserted in DB.

But I am now using local JMS transaction and this exception is creating
issues. For each JMS message, I see 7 ERROR messages in log and 7 similar
records are getting inserted in DB. Without local JMS transaction, it works
fine.

Apart from upgrading to higher Camel version, anybody has faced this issue
and figured the solution? All inputs are welcome.

Thanks
Shiv



--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-DB-inserts-due-to-org-apache-camel-impl-DefaultMessage-cannot-be-cast-to-org-apache-camel-cn-tp5750959.html
Sent from the Camel - Users mailing list archive at Nabble.com.