Note that there are some explanatory texts on larger screens.

plurals
  1. POObject with collection containing Serializable, non-primitive objects can't be set as ActiveMQ ObjectMessage
    primarykey
    data
    text
    <p>I'd appreciate any help on this...</p> <p>I have an Object I'm trying to send in a JMS ObjectMessage by calling setObject. This Object contains a HashMap content as well as some other fields. When the map contains primitive elements the message is built fine. Likewise if I add a non-primitive serializable field to the Object it also sends ok. </p> <p>Here's the rub: Whenever I try to add a serializable non-primitive object to the MAP I get the following MessageFormatException:</p> <pre><code>javax.jms.MessageFormatException: Only objectified primitive objects, String, Map and List types are allowed but was: com.abc.ObjectInList </code></pre> <p>The javadoc for ObjectMessage specifies... </p> <blockquote> <p>Only Serializable Java objects can be used.</p> </blockquote> <p>... check. And ...</p> <blockquote> <p>If a collection of Java objects must be sent, one of the Collection classes provided since JDK 1.2 can be used.</p> </blockquote> <p>... double check. While this doesn't specifically say anything about Serializable objects in a Collection, I guess I would assume this would be supported. Am I doing something wrong here? Do I just bite the bullet and make a new field in my top level Object so I don't have to put it in the Collection?</p> <p>Using ActiveMQ 5.2. A pertinent Stack Trace follows.</p> <blockquote> <p>2011-08-01 21:06:05,767 ERROR javax.jms.MessageFormatException: Only objectified primitive objects, String, Map and List types are allowed but was: com.abc.engine.ejb.BasicSchedule@58f295b9 type: class c om.abc.engine.ejb.BasicSchedule 2011-08-01 21:06:05,767 ERROR at org.apache.activemq.command.ActiveMQMessage.checkValidObject(ActiveMQMessage.java:468) 2011-08-01 21:06:05,767 ERROR at org.apache.activemq.command.ActiveMQMapMessage.setObject(ActiveMQMapMessage.java:705) 2011-08-01 21:06:05,767 ERROR at com.abc.chronicle.ejb.ChronicleMessageBean.initMessage(ChronicleMessageBean.java:149) 2011-08-01 21:06:05,767 ERROR at com.abc.chronicle.ejb.ChronicleMessageBean.send(ChronicleMessageBean.java:125) 2011-08-01 21:06:05,767 ERROR at com.abc.chronicle.ejb.ChronicleMessageBean.onMessage(ChronicleMessageBean.java:77) 2011-08-01 21:06:05,767 ERROR at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)2011-08-01 21:06:05,768 ERROR at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2011-08-01 21:06:05,777 ERROR [com.abc.chronicle.ejb.ChronicleMessageBean] JMS Exception Sending Message to SDK.OUTGOING_NOTIFICATION : javax.jms.MessageFormatException: Only objectified primitive objects, String, Ma p and List types are allowed but was: com.abc.engine.ejb.BasicSchedule@1003b2df type: class com.abc.engine.ejb.BasicSchedule 2011-08-01 21:06:05,778 ERROR javax.jms.MessageFormatException: Only objectified primitive objects, String, Map and List types are allowed but was: com.abc.engine.ejb.BasicSchedule@1003b2df type: class c om.abc.engine.ejb.BasicSchedule 2011-08-01 21:06:05,778 ERROR at org.apache.activemq.command.ActiveMQMessage.checkValidObject(ActiveMQMessage.java:468) 2011-08-01 21:06:05,778 ERROR at org.apache.activemq.command.ActiveMQMapMessage.setObject(ActiveMQMapMessage.java:705) 2011-08-01 21:06:05,778 ERROR at com.abc.chronicle.ejb.ChronicleMessageBean.initMessage(ChronicleMessageBean.java:149) 2011-08-01 21:06:05,778 ERROR at com.abc.chronicle.ejb.ChronicleMessageBean.send(ChronicleMessageBean.java:125) 2011-08-01 21:06:05,778 ERROR at com.abc.chronicle.ejb.ChronicleMessageBean.onMessage(ChronicleMessageBean.java:77)</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload