send multiple object messages with same queue & connection factory?
Hi All,
I am wondering whether it is possible to send multiple entity objects using the same JMS Queue (PTP) and Connection factory. I have successfully created a working JMS application that generate "vehicle" message, which in turn create/persist a new "vehicle" entity. However, the following exception has been encountered when attempting to duplicate the same message producer and consumer codes while utilizing the same connection queue and factory:
MQRA:OMR:run:Caught Exception from onMessage():Redelivering:message-driven bean method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message) system exception
*MDB00037: [vehicleConsumer:JmsShipMDB]: Message-driven bean invocation exception: [javax.ejb.EJBException]*
javax.ejb.EJBException
at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3894)
at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3794)
at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3596)
at com.sun.ejb.containers.MessageBeanContainer.afterMessageDeliveryInternal(MessageBeanContainer.java:1226)
at com.sun.ejb.containers.MessageBeanContainer.afterMessageDelivery(MessageBeanContainer.java:1197)
at com.sun.ejb.containers.MessageBeanListenerImpl.afterMessageDelivery(MessageBeanListenerImpl.java:79)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:139)
at $Proxy99.afterDelivery(Unknown Source)
at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:324)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:76)
at com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)
Caused by: java.lang.ClassCastException: domain.vehicle cannot be cast to domain.Ship
at ejb.JmsShipMDB.onMessage(JmsShipMDB.java:37)
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 com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011)
at com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175)
at com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2920)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4011)
at com.sun.ejb.containers.MessageBeanContainer.deliverMessage(MessageBeanContainer.java:1111)
at com.sun.ejb.containers.MessageBeanListenerImpl.deliverMessage(MessageBeanListenerImpl.java:74)
at com.sun.enterprise.connectors.inflow.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:179)
at $Proxy99.onMessage(Unknown Source)
at com.sun.messaging.jms.ra.OnMessageRunner.run(OnMessageRunner.java:258)
*... 2 more*
MQRA:OMR:run:Caught Exception from onMessage():Redelivering:message-driven bean method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message) system exception
MQRA:OMR:run:Exhausted redeliveryAttempts-msg=com.sun.messaging.jms.ra.DirectObjectPacket@14d4267
MQRA:OMR:run:Exhausted redeliveryAttempts-spec=ActvationSpec configuration=
DestinationType =javax.jms.Queue
Destination =vehicleQueue
MessageSelector =null
AcknowledgeMode =Auto-acknowledge
SubscriptionDurability =NonDurable
ClientId =null
SubscriptionName =null
EndpointPoolMaxSize =32
EndpointPoolSteadySize =0
EndpointPoolResizeCount =8
EndpointPoolResizeTimeout =600
EndpointExceptionRedeliveryAttempts =1
EndpointExceptionRedeliveryInterval =500
SendUndeliverableMsgsToDMQ =true
GroupName =null
RAUID =null
InClusteredContainer =false
MdbName =null
UserName =null
EnableDirect =true
AddressList (in effect) =localhost:7676
MQRA:OMR:run:Message returned & marked for routing to the DMQ
MQRA:OMR:run:omrId=0:Acked Undeliverable-Msg=com.sun.messaging.jms.ra.DirectObjectPacket@14d4267
*MDB00037: [vehicleConsumer:JmsShipMDB]: Message-driven bean invocation exception: [javax.ejb.EJBException]*
javax.ejb.EJBException
Thanks in advance,
Jack