I get this error as well but my hashmap is not deeply nested and there are no primitive values in it. It happen very rarely though. Maybe 1 in 20,000 plus messages.
Any insights into fixes or workarounds available? -Rob JIRA j...@apache.org wrote: > > java.io.OptionalDataException when getting a deeply nested HashMap from an > ObjectMessage > ---------------------------------------------------------------------------------------- > > Key: AMQ-2083 > URL: https://issues.apache.org/activemq/browse/AMQ-2083 > Project: ActiveMQ > Issue Type: Bug > Affects Versions: 5.2.0 > Environment: JRE 1.5.0_12 > Reporter: Martin Haslinger > > > In rare occasions getting a HashMap from an ObjectMessage leads to the > following error: > > javax.jms.JMSException: Failed to build body from bytes. Reason: > java.io.OptionalDataException > at > org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:35) > at > org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:183) > Caused by: java.io.OptionalDataException > at java.io.ObjectInputStream.readObject0(Unknown Source) > at java.io.ObjectInputStream.readObject(Unknown Source) > at java.util.HashMap.readObject(Unknown Source) > at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) > at java.io.ObjectInputStream.readSerialData(Unknown Source) > at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) > at java.io.ObjectInputStream.readObject0(Unknown Source) > at java.io.ObjectInputStream.readObject(Unknown Source) > at java.util.HashMap.readObject(Unknown Source) > at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) > at java.io.ObjectInputStream.readSerialData(Unknown Source) > at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) > at java.io.ObjectInputStream.readObject0(Unknown Source) > at java.io.ObjectInputStream.readObject(Unknown Source) > at java.util.HashMap.readObject(Unknown Source) > at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) > at java.io.ObjectInputStream.readSerialData(Unknown Source) > at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) > at java.io.ObjectInputStream.readObject0(Unknown Source) > at java.io.ObjectInputStream.readObject(Unknown Source) > at > org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:177) > ... 8 more > > The only difference in the testing application to all other messages is > that the object is a deeply nested map, it is: HashMap<String, > HashMap<String, HashMap<String,String>>> > > Alltough the OptionalDataException indicates some primitive values being > written somewhere, there are absolute no primitive values around there. > > -- > This message is automatically generated by JIRA. > - > You can reply to this email to add a comment to the issue online. > > > -- View this message in context: http://www.nabble.com/-jira--Created%3A-%28AMQ-2083%29-java.io.OptionalDataException-when-getting-a-deeply-nested-HashMap-from-an-ObjectMessage-tp21580409p22015587.html Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.