Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6229945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:39:34+00:00 2026-05-24T09:39:34+00:00

I’d appreciate any help on this… I have an Object I’m trying to send

  • 0

I’d appreciate any help on this…

I have an Object I’m trying to send in a JMS ObjectMessage by calling setObject. This Object contains a HashMap<String, Object> 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.

Here’s the rub: Whenever I try to add a serializable non-primitive object to the MAP I get the following MessageFormatException:

javax.jms.MessageFormatException: Only objectified primitive objects, String, 
Map and List types are allowed but was: com.abc.ObjectInList

The javadoc for ObjectMessage specifies…

Only Serializable Java objects can be used.

… check. And …

If a collection of Java objects must be sent, one of the Collection classes provided since JDK 1.2 can be used.

… 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?

Using ActiveMQ 5.2. A pertinent Stack Trace follows.

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 com.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, Map 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 com.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)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T09:39:35+00:00Added an answer on May 24, 2026 at 9:39 am

    Although I haven’t checked it, but looking at the source code it seems like you hit this exception when ActiveMQ validates message properties, not the body. The JavaDoc for ObjectMessage reads:

    Only Serializable Java objects can be used.

    I used all sorts of Java objects with ActiveMQ (arbitrary complex) and it always worked. However when you set message properties (Message#setObjectProperty):

    Note that this method works only for the objectified primitive object types (Integer, Double, Long …) and String objects.

    Inspecting the ActiveMQ codebase quoted above it looks like you are trying to use message object properties to send complex Java objects. This abuses the concept of message properties, which should be simple metadata like ids or peer names.

    Also it looks like ActiveMQ optionally supports Map and List, but it this is vendor specific.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.