You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2016/01/11 17:42:39 UTC

[jira] [Closed] (AMQ-6110) ObjectMessage exception is swallowed

     [ https://issues.apache.org/jira/browse/AMQ-6110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish closed AMQ-6110.
-----------------------------
    Resolution: Duplicate

> ObjectMessage exception is swallowed
> ------------------------------------
>
>                 Key: AMQ-6110
>                 URL: https://issues.apache.org/jira/browse/AMQ-6110
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.13.0
>         Environment: Oracle JDK 1.8.0_66
>            Reporter: Amichai Rothman
>            Priority: Minor
>
> After upgrading to 5.13.0, I started getting opaque exceptions from ActiveMQObjectMessage.getObject (see full stacktrace below). Since the error messages were quite cryptic, I had to debug through the ActiveMQObjectMessage and ObjectInputStream code, and only with a breakpoint in ObjectInputStream.readOrdinaryObject I saw the internally thrown exception, which has an excellent informative message: "java.lang.ClassNotFoundException: Forbidden class com.myapp.MyObject! This class is not allowed to be serialized. Add package with 'org.apache.activemq.SERIALIZABLE_PACKAGES' system property."
> That would have been very useful to know, if only it were propagated to somewhere the user can see it. This is arguably a bug in the JDK itself, but I think it may be an ActiveMQ issue after all, since the JDK code has special handling for ClassNotFoundException which seems to swallow it, and it is not entirely correct for ClassNotFoundException to be thrown by ActiveMQ since the class is found, but simply has security restrictions on it. Perhaps a SecurityException or some other more accurate exception should be thrown, and will get handled differently and propagated to the user. I'm not sure this is the case, just guessing here, but I'm reporting this issue so someone knowledgeable on this code can determine how/where it should be solved.
> As it stands, it wastes a lot of developer time for no reason (I'm sure I'm not the only one upgrading to 5.13.0 or using future versions that will miss the system property now required for serialization). There's a great informative exception message, and it's a shame it gets swallowed.
> The user-facing stack trace:
> {quote}
> javax.jms.JMSException: Failed to build body from bytes. Reason: java.io.StreamCorruptedException: invalid type code: 69
> 	at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:198)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at com.myapp.jms.Consumer.onMessage(Consumer.java:33)[27:com.myapp.jms:0.1.0.SNAPSHOT]
> 	at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1393)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_66]
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_66]
> 	at java.lang.Thread.run(Thread.java:745)[:1.8.0_66]
> Caused by: java.io.StreamCorruptedException: invalid type code: 69
> 	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1522)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readClass(ObjectInputStream.java:1484)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1334)[:1.8.0_66]
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1707)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1345)[:1.8.0_66]
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)[:1.8.0_66]
> 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2000)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1891)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)[:1.8.0_66]
> 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)[:1.8.0_66]
> 	at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:191)[74:org.apache.activemq.activemq-osgi:5.13.0]
> 	... 9 more
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)