java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload

MuleSoft JIRA | Will Johnson | 9 years ago
  1. 0

    It appears that using global endpoints with jms (and possibly others) causes default transformers to not be run as the 3 test cases show below. This is not a problem if the endpoint is configured non-globally. More interestingly is that all 3 test cases fail in the seda-optimized model which seems to have serious problems (http://www.nabble.com/Using-seda-optimised-tf4655805.html) Code used to send in messages to each endpoint: MuleClient client = new MuleClient(); MuleClient MuleMessage muleMsg = new MuleMessage(p); muleMsg.setProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); UMOMessage umoResp = client.send("jms://echo" + i, muleMsg); System.out.println(umoResp);client = new MuleClient(); And the mule config is: {code:xml} <connector name="jmsConnector" className="org.mule.providers.jms.activemq.ActiveMqJmsConnector"> <properties> <property name="connectionFactoryJndiName" value="ConnectionFactory"/> <property name="jndiInitialFactory" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/> <property name="jndiProviderUrl" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/> <property name="specification" value="1.1"/> </properties> </connector> <global-endpoints> <endpoint name="echo1" address="jms://echo1" synchronous="true" transformers="Jms2Obj" responseTransformers="Obj2Jms" /> <endpoint name="echo2" address="jms://echo2" synchronous="true" /> </global-endpoints> <model name="jmstest"> <!-- this is ok --> <mule-descriptor name="echo1" implementation="com.foo.JMSTest"> <inbound-router> <global-endpoint name="echo1" /> </inbound-router> </mule-descriptor> <!-- this fails --> <mule-descriptor name="echo2" implementation="com.foo.JMSTest"> <inbound-router> <global-endpoint name="echo2" /> </inbound-router> </mule-descriptor> <!-- this is ok --> <mule-descriptor name="echo3" implementation="com.foo.JMSTest"> <inbound-router> <endpoint address="jms://echo3" synchronous="true" /> </inbound-router> </mule-descriptor> </model> {code} the error is: org.mule.providers.DefaultMessageAdapter/org.mule.providers.DefaultMessageAdapter@e35bb7{id=ID:will-1234-1193747149406-2:0:7:1:1, payload=com.foo.app.JMSTest$Payload, correlationId=null, correlationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null, properties={ MULE_ENDPOINT=jms://echo1 JMSExpiration=0 JMSTimestamp=1193747150843 JMSDestination=temp-queue://ID:will-1234-1193747149406-2:0:1 JMSRedelivered=false JMSDeliveryMode=1 MULE_SESSION=SUQ9NDAzNGVhOWUtODZlMy0xMWRjLWEwODMtMDllOWQwZjY2ZjI2 MULE_ORIGINATING_ENDPOINT=jms.echo1 JMSMessageID=ID:will-1234-1193747149406-2:0:7:1:1 JMSPriority=4 }} 2007-10-30 08:25:50,906 ERROR DefaultComponentExceptionStrategy - ******************************************************************************** Message : Failed to invoke com.foo.app.JMSTest. Component that caused exception is: echo2. Message payload is of type: ActiveMQObjectMessage Type : org.mule.umo.ComponentException Code : MULE_ERROR-79999 Payload : ActiveMQObjectMessage {commandId = 33, responseRequired = false, messageId = ID:will-1234-1193747149406-2:0:9:1:1, originalDestination = null, originalTransactionId = null, producerId ID:will-1234-1193747149406-2:0:9:1, destination = queue://echo2, transactionId = null, expiration = 0, timestamp = 1193747150875, arrival = 0, correlationId = null, replyTo = temp-queue://ID:will-1234-119347149406-2:0:2, persistent = false, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apacheactivemq.util.ByteSequence@1e1be92, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 726, properties = {MULE_SESION=SUQ9NDA0Y2RmNzgtODZlMy0xMWRjLWEwODMtMDllOWQwZjY2ZjI2, MULE_ENDPOINT=jms://echo2, MULE_REMOTE_SYNC=true}, readOnlyProperties = true, readOnlyBody = true, droppable false} JavaDoc : http://mule.mulesource.org/docs/apidocs/org/mule/umo/ComponentException.html ******************************************************************************** Exception stack is: 1. org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload (java.lang.ClassCastException) com.foo.app.JMSTest:62 (null) 2. Failed to invoke com.foo.app.JMSTest. Component that caused exception is: echo2. Message payload is of type: ActiveMQObjectMessage (org.mule.umo.ComponentException) org.mule.impl.DefaultLifecycleAdapter:200 (http://mule.mulesource.org/docs/apidocs/org/mule/umo/ComponentException.html) ******************************************************************************** Root Exception stack trace: java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload at com.foo.app.JMSTest.onCall(JMSTest.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mule.impl.model.resolvers.DynamicEntryPoint.invokeMethod(DynamicEntryPoint.java:312) at org.mule.impl.model.resolvers.DynamicEntryPoint.invoke(DynamicEntryPoint.java:259) at org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:194) at org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47) at org.mule.impl.model.DefaultMuleProxy.onCall(DefaultMuleProxy.java:258) at org.mule.impl.model.seda.SedaComponent.doSend(SedaComponent.java:398) at org.mule.impl.model.AbstractComponent.sendEvent(AbstractComponent.java:418) at org.mule.impl.MuleSession.sendEvent(MuleSession.java:349) at org.mule.routing.inbound.InboundRouterCollection.send(InboundRouterCollection.java:197) at org.mule.routing.inbound.InboundRouterCollection.route(InboundRouterCollection.java:163) at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:581) at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:322) at org.mule.providers.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:107) at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:92) at org.mule.providers.AbstractReceiverWorker.doRun(AbstractReceiverWorker.java:124) at org.mule.providers.AbstractReceiverWorker.run(AbstractReceiverWorker.java:60) at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528) at java.lang.Thread.run(Thread.java:619) ******************************************************************************** 2007-10-30 08:25:50,921 WARN ExceptionHelper - Failed to load error mappings from: META-INF/services/org/mule/config/jms-exception-mappings.properties. This may be because there are no error code appings for protocol: jms null Payload in Service: Payload: 3 org.mule.providers.DefaultMessageAdapter/org.mule.providers.DefaultMessageAdapter@7ecd78{id=ID:will-1234-1193747149406-2:0:14:1:1, payload=com.foo.app.JMSTest$Payload, correlationId=null, orrelationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null, properties={ MULE_ENDPOINT=jms://echo3 JMSExpiration=0 JMSTimestamp=1193747160953 JMSDestination=temp-queue://ID:will-1234-1193747149406-2:0:3 JMSRedelivered=false JMSDeliveryMode=1 MULE_SESSION=SUQ9NDY0YzM2NWUtODZlMy0xMWRjLWEwODMtMDllOWQwZjY2ZjI2 MULE_ORIGINATING_ENDPOINT=endpoint.jms.echo3 JMSMessageID=ID:will-1234-1193747149406-2:0:14:1:1 JMSPriority=4 }}

    MuleSoft JIRA | 9 years ago | Will Johnson
    java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload
  2. 0

    It appears that using global endpoints with jms (and possibly others) causes default transformers to not be run as the 3 test cases show below. This is not a problem if the endpoint is configured non-globally. More interestingly is that all 3 test cases fail in the seda-optimized model which seems to have serious problems (http://www.nabble.com/Using-seda-optimised-tf4655805.html) Code used to send in messages to each endpoint: MuleClient client = new MuleClient(); MuleClient MuleMessage muleMsg = new MuleMessage(p); muleMsg.setProperty(MuleProperties.MULE_REMOTE_SYNC_PROPERTY, true); UMOMessage umoResp = client.send("jms://echo" + i, muleMsg); System.out.println(umoResp);client = new MuleClient(); And the mule config is: {code:xml} <connector name="jmsConnector" className="org.mule.providers.jms.activemq.ActiveMqJmsConnector"> <properties> <property name="connectionFactoryJndiName" value="ConnectionFactory"/> <property name="jndiInitialFactory" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/> <property name="jndiProviderUrl" value="vm://localhost?broker.persistent=false&amp;broker.useJmx=false"/> <property name="specification" value="1.1"/> </properties> </connector> <global-endpoints> <endpoint name="echo1" address="jms://echo1" synchronous="true" transformers="Jms2Obj" responseTransformers="Obj2Jms" /> <endpoint name="echo2" address="jms://echo2" synchronous="true" /> </global-endpoints> <model name="jmstest"> <!-- this is ok --> <mule-descriptor name="echo1" implementation="com.foo.JMSTest"> <inbound-router> <global-endpoint name="echo1" /> </inbound-router> </mule-descriptor> <!-- this fails --> <mule-descriptor name="echo2" implementation="com.foo.JMSTest"> <inbound-router> <global-endpoint name="echo2" /> </inbound-router> </mule-descriptor> <!-- this is ok --> <mule-descriptor name="echo3" implementation="com.foo.JMSTest"> <inbound-router> <endpoint address="jms://echo3" synchronous="true" /> </inbound-router> </mule-descriptor> </model> {code} the error is: org.mule.providers.DefaultMessageAdapter/org.mule.providers.DefaultMessageAdapter@e35bb7{id=ID:will-1234-1193747149406-2:0:7:1:1, payload=com.foo.app.JMSTest$Payload, correlationId=null, correlationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null, properties={ MULE_ENDPOINT=jms://echo1 JMSExpiration=0 JMSTimestamp=1193747150843 JMSDestination=temp-queue://ID:will-1234-1193747149406-2:0:1 JMSRedelivered=false JMSDeliveryMode=1 MULE_SESSION=SUQ9NDAzNGVhOWUtODZlMy0xMWRjLWEwODMtMDllOWQwZjY2ZjI2 MULE_ORIGINATING_ENDPOINT=jms.echo1 JMSMessageID=ID:will-1234-1193747149406-2:0:7:1:1 JMSPriority=4 }} 2007-10-30 08:25:50,906 ERROR DefaultComponentExceptionStrategy - ******************************************************************************** Message : Failed to invoke com.foo.app.JMSTest. Component that caused exception is: echo2. Message payload is of type: ActiveMQObjectMessage Type : org.mule.umo.ComponentException Code : MULE_ERROR-79999 Payload : ActiveMQObjectMessage {commandId = 33, responseRequired = false, messageId = ID:will-1234-1193747149406-2:0:9:1:1, originalDestination = null, originalTransactionId = null, producerId ID:will-1234-1193747149406-2:0:9:1, destination = queue://echo2, transactionId = null, expiration = 0, timestamp = 1193747150875, arrival = 0, correlationId = null, replyTo = temp-queue://ID:will-1234-119347149406-2:0:2, persistent = false, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apacheactivemq.util.ByteSequence@1e1be92, marshalledProperties = null, dataStructure = null, redeliveryCounter = 0, size = 726, properties = {MULE_SESION=SUQ9NDA0Y2RmNzgtODZlMy0xMWRjLWEwODMtMDllOWQwZjY2ZjI2, MULE_ENDPOINT=jms://echo2, MULE_REMOTE_SYNC=true}, readOnlyProperties = true, readOnlyBody = true, droppable false} JavaDoc : http://mule.mulesource.org/docs/apidocs/org/mule/umo/ComponentException.html ******************************************************************************** Exception stack is: 1. org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload (java.lang.ClassCastException) com.foo.app.JMSTest:62 (null) 2. Failed to invoke com.foo.app.JMSTest. Component that caused exception is: echo2. Message payload is of type: ActiveMQObjectMessage (org.mule.umo.ComponentException) org.mule.impl.DefaultLifecycleAdapter:200 (http://mule.mulesource.org/docs/apidocs/org/mule/umo/ComponentException.html) ******************************************************************************** Root Exception stack trace: java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload at com.foo.app.JMSTest.onCall(JMSTest.java:62) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.mule.impl.model.resolvers.DynamicEntryPoint.invokeMethod(DynamicEntryPoint.java:312) at org.mule.impl.model.resolvers.DynamicEntryPoint.invoke(DynamicEntryPoint.java:259) at org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:194) at org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47) at org.mule.impl.model.DefaultMuleProxy.onCall(DefaultMuleProxy.java:258) at org.mule.impl.model.seda.SedaComponent.doSend(SedaComponent.java:398) at org.mule.impl.model.AbstractComponent.sendEvent(AbstractComponent.java:418) at org.mule.impl.MuleSession.sendEvent(MuleSession.java:349) at org.mule.routing.inbound.InboundRouterCollection.send(InboundRouterCollection.java:197) at org.mule.routing.inbound.InboundRouterCollection.route(InboundRouterCollection.java:163) at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:581) at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:322) at org.mule.providers.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:107) at org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:92) at org.mule.providers.AbstractReceiverWorker.doRun(AbstractReceiverWorker.java:124) at org.mule.providers.AbstractReceiverWorker.run(AbstractReceiverWorker.java:60) at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528) at java.lang.Thread.run(Thread.java:619) ******************************************************************************** 2007-10-30 08:25:50,921 WARN ExceptionHelper - Failed to load error mappings from: META-INF/services/org/mule/config/jms-exception-mappings.properties. This may be because there are no error code appings for protocol: jms null Payload in Service: Payload: 3 org.mule.providers.DefaultMessageAdapter/org.mule.providers.DefaultMessageAdapter@7ecd78{id=ID:will-1234-1193747149406-2:0:14:1:1, payload=com.foo.app.JMSTest$Payload, correlationId=null, orrelationGroup=-1, correlationSeq=-1, encoding=UTF-8, exceptionPayload=null, properties={ MULE_ENDPOINT=jms://echo3 JMSExpiration=0 JMSTimestamp=1193747160953 JMSDestination=temp-queue://ID:will-1234-1193747149406-2:0:3 JMSRedelivered=false JMSDeliveryMode=1 MULE_SESSION=SUQ9NDY0YzM2NWUtODZlMy0xMWRjLWEwODMtMDllOWQwZjY2ZjI2 MULE_ORIGINATING_ENDPOINT=endpoint.jms.echo3 JMSMessageID=ID:will-1234-1193747149406-2:0:14:1:1 JMSPriority=4 }}

    MuleSoft JIRA | 9 years ago | Will Johnson
    java.lang.ClassCastException: org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload
  3. 0

    Memcached Java客户端2.6.1发布 - 编程语言 - ITeye资讯

    iteye.com | 1 year ago
    java.lang.ClassCastException: cannot be cast to
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Scala 2.11.5 and Squeryl?

    Google Groups | 2 years ago | Clint Gilbert
    java.lang.ClassCastException: scala.None$ cannot be cast to
  6. 0

    adam2vcf

    Google Groups | 8 months ago | someya sayeh
    java.lang.ClassCastException: org.bdgenomics.formats.avro.Fragment cannot be cast to

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.apache.activemq.command.ActiveMQObjectMessage cannot be cast to com.foo.app.JMSTest$Payload

      at com.foo.app.JMSTest.onCall()
    2. com.foo.app
      JMSTest.onCall
      1. com.foo.app.JMSTest.onCall(JMSTest.java:62)
      1 frame
    3. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    4. Annotations
      DynamicEntryPoint.invoke
      1. org.mule.impl.model.resolvers.DynamicEntryPoint.invokeMethod(DynamicEntryPoint.java:312)
      2. org.mule.impl.model.resolvers.DynamicEntryPoint.invoke(DynamicEntryPoint.java:259)
      2 frames
    5. org.mule.impl
      MuleSession.sendEvent
      1. org.mule.impl.DefaultLifecycleAdapter.intercept(DefaultLifecycleAdapter.java:194)
      2. org.mule.impl.InterceptorsInvoker.execute(InterceptorsInvoker.java:47)
      3. org.mule.impl.model.DefaultMuleProxy.onCall(DefaultMuleProxy.java:258)
      4. org.mule.impl.model.seda.SedaComponent.doSend(SedaComponent.java:398)
      5. org.mule.impl.model.AbstractComponent.sendEvent(AbstractComponent.java:418)
      6. org.mule.impl.MuleSession.sendEvent(MuleSession.java:349)
      6 frames
    6. org.mule.routing
      InboundRouterCollection.route
      1. org.mule.routing.inbound.InboundRouterCollection.send(InboundRouterCollection.java:197)
      2. org.mule.routing.inbound.InboundRouterCollection.route(InboundRouterCollection.java:163)
      2 frames
    7. org.mule.providers
      AbstractReceiverWorker$1.doInTransaction
      1. org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:581)
      2. org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:322)
      3. org.mule.providers.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:107)
      3 frames
    8. Mule Core
      TransactionTemplate.execute
      1. org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:92)
      1 frame
    9. org.mule.providers
      AbstractReceiverWorker.run
      1. org.mule.providers.AbstractReceiverWorker.doRun(AbstractReceiverWorker.java:124)
      2. org.mule.providers.AbstractReceiverWorker.run(AbstractReceiverWorker.java:60)
      2 frames
    10. org.mule.impl
      WorkerContext.run
      1. org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
      1 frame
    11. Backport of JSR 166
      ThreadPoolExecutor$Worker.run
      1. edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:987)
      2. edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:528)
      2 frames
    12. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:619)
      1 frame