You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by kellny <ni...@db.com> on 2011/07/12 11:27:40 UTC

Unable-to-catch-exception-from-Camel

Hi
I've created small app which receives messages and answers in temprary
queue.This temprary queue set client in JMSReplyTo. In case if client
disconnect then TQ become unavailable but I can't catch exception.
Could you help me? 

This is my root.

<endpoint id="in" uri="jmstx:topic:${jms.topic}" />

		<route id="main">
			<from ref="in" />
			<onException useOriginalMessage="false">
				<exception>org.apache.camel.RuntimeCamelException</exception>		
				<exception>*javax.jms.InvalidDestinationException*</exception>	
			
<exception>*org.springframework.jms.InvalidDestinationException*</exception>
				<redeliveryPolicy maximumRedeliveries="0" logHandled="false" />
				<handled>
					<constant>true</constant>
				</handled>
				<process ref="invalidDestinationProcessor" />
			</onException>									
   		   <bean ref="process" />
		</route>

--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-catch-exception-from-Camel-tp4578302p4578302.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unable-to-catch-exception-from-Camel

Posted by kellny <ni...@db.com>.
I'm not sure that it is a good solution.I've just switched off an auto reply
process and made a response throught CamelJmsDestination.

<endpoint id="in" uri="jmstx:topic:${jms.topic}?disableReplyTo=true" />

          <route id="main" >
		   <from ref="in"/>			
                   <onException useOriginalMessage="false">  
                     
<exception>org.springframework.jms.InvalidDestinationException</exception>
                      <redeliveryPolicy maximumRedeliveries="0"
logHandled="false" />
                      <handled>
                              <constant>true</constant>
                      </handled>
                      <process ref="invalidDestinationProcessor" />
                   </onException>   								
   		   <bean ref="reply" />
		   <to uri="jmstx:queue:dummy" />
	  </route>
Is it a good solution?

--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-catch-exception-from-Camel-tp4578302p4582894.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Unable-to-catch-exception-from-Camel

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

It seems the stacktrace is from the EndpointMessageListener which is
used for consuming messages on JMS message queues.
The exception is thrown by spring-jms (which is used for consuming JMS
messages). And thus the exception cannot be handled by Camel in
traditional way (using errorHandler, onException etc.). See chapter 4
in the Camel book for more details.

Essentially the exception happens *before* Camel receives the messages
from the underlying component API/framework (which in this case is
spring-jms). So to handle those kind of exceptions/errors it becomes
component specific, whether they allow end users to deal with those
exceptions.

The JMS component has an exceptionListener option you can configure
and have spring-jms invoke with the caused exception.




On Tue, Jul 12, 2011 at 11:31 AM, kellny <ni...@db.com> wrote:
> This is stack trace.I can't catch
> *org.springframework.jms.InvalidDestinationException* in my root.
>
> 2011-07-12 07:26:59,264 [Camel (camelContext) thread #0 -
> JmsConsumer[trs-reception-0]] DEBUG [JmsConfiguration$CamelJmsTemplate]
> Executing callback on JMS Session:
> com.tibco.tibjms.TibjmsxSessionImp@13c33b7
> 2011-07-12 07:26:59,264 [Camel (camelContext) thread #0 -
> JmsConsumer[trs-reception-0]] DEBUG [EndpointMessageListener] Caused by:
> [org.apache.camel.RuntimeCamelException -
> org.springframework.jms.InvalidDestinationException: Invalid temporary
> destination; nested exception is javax.jms.InvalidDestinationException:
> Invalid temporary destination]
> org.apache.camel.RuntimeCamelException:
> org.springframework.jms.InvalidDestinationException: Invalid temporary
> destination; nested exception is javax.jms.InvalidDestinationException:
> Invalid temporary destination
>        at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
>        at
> org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:143)
>        at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
>        at
> org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
>        at
> org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
>        at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
>        at
> org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
>        at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
>        at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
>        at
> org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>        at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>        at java.lang.Thread.run(Thread.java:619)
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Unable-to-catch-exception-from-Camel-tp4578302p4578310.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Unable-to-catch-exception-from-Camel

Posted by kellny <ni...@db.com>.
This is stack trace.I can't catch
*org.springframework.jms.InvalidDestinationException* in my root.

2011-07-12 07:26:59,264 [Camel (camelContext) thread #0 -
JmsConsumer[trs-reception-0]] DEBUG [JmsConfiguration$CamelJmsTemplate]
Executing callback on JMS Session:
com.tibco.tibjms.TibjmsxSessionImp@13c33b7
2011-07-12 07:26:59,264 [Camel (camelContext) thread #0 -
JmsConsumer[trs-reception-0]] DEBUG [EndpointMessageListener] Caused by:
[org.apache.camel.RuntimeCamelException -
org.springframework.jms.InvalidDestinationException: Invalid temporary
destination; nested exception is javax.jms.InvalidDestinationException:
Invalid temporary destination]
org.apache.camel.RuntimeCamelException:
org.springframework.jms.InvalidDestinationException: Invalid temporary
destination; nested exception is javax.jms.InvalidDestinationException:
Invalid temporary destination
	at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
	at
org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:143)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:560)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:498)
	at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)

--
View this message in context: http://camel.465427.n5.nabble.com/Unable-to-catch-exception-from-Camel-tp4578302p4578310.html
Sent from the Camel - Users mailing list archive at Nabble.com.