1 Reply Latest reply on Mar 7, 2011 1:07 AM by Claus Ibsen

    apache.camel.util.ObjectHelper & java.lang.RuntimeException

    Peter Chandler Master

      Help: Looks like there is a ClassCastException occurring somewhere? I set logging to TRACE and still have no clue where the error is occurring? Seems that ObjectHelper.wrapRuntimeCamelException wraps a java.lang.RuntimeException and never prints/logs it? Help. Any suggestions on how to debug a org.apache.camel.RuntimeCamelException?   

       

      Exception:

      2011-03-03 11:28:09,660 [DefaultMessageListenerContainer-1|http://fusesource.com/forums/] TRACE - Total 0 inflight exchanges. Last removed: ID:tfdmgw1-51465-1299013433026-0:140730:1:1:1
      2011-03-03 11:28:09,660 [DefaultMessageListenerContainer-1|http://fusesource.com/forums/] TRACE - route: Recording duration: 0 millis for exchange: Exchange--JmsMessage: ActiveMQBytesMessage {commandId = 5, responseRequired = true, messageId = ID:tfdmgw1-51465-1299013433026-0:140730:1:1:1, originalDestination = null, originalTransactionId = null, producerId = ID:tfdmgw1-51465-1299013433026-0:140730:1:1, destination = topic://TEST, transactionId = null, expiration = 0, timestamp = 1299169689571, arrival = 0, brokerInTime = 1299169689571, brokerOutTime = 1299169689659, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence@263f94f3, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 0, properties = null, readOnlyProperties = true, readOnlyBody = true, droppable = false} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = java.io.DataInputStream@21c43d4b }--
      2011-03-03 11:28:09,660 [DefaultMessageListenerContainer-1|http://fusesource.com/forums/] TRACE - onMessage.process END
      2011-03-03 11:28:09,660 [DefaultMessageListenerContainer-1|http://fusesource.com/forums/] ERROR - Caused by: [http://org.apache.camel.RuntimeCamelException - java.lang.ClassCastException]
      org.apache.camel.RuntimeCamelException: java.lang.ClassCastException
              at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1055)
              at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:104)
              at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:543)
              at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:482)
              at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
              at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
              at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:261)
              at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
              at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
              at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
              at java.lang.Thread.run(Thread.java:619)
      

       

      Suggestion:

           public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) {
                if (e instanceof RuntimeCamelException) {
                    // don't double wrap
                    return (RuntimeCamelException)e;
                } else {
                     {
                         if (LOG.isDebugEnabled()) {
                              LOG.debug("Wrapping Runtime Exception: ", e);
                             return new RuntimeCamelException(e);
                     }
                }
           }