Serialization Exception with Object Messages.

Solution Verified - Updated -

Issue

  • After installing hotfix 6.2.1 rollup 2 ActiveMQ stopped working even if jvm property is set according to http://activemq.apache.org/objectmessage.html. Fuse process is running with
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES="*"
  • also tried
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES="com.mycompany.packages,java.lang,java.util"
  • but we still get the
javax.jms.JMSException: Failed to build body from content. Serializable class not available to broker. Reason: java.lang.ClassNotFoundException: Forbidden class com.mycompany.packages.ABC! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
        at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:208)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at com.mycompany.packages.ABC.handleMessage(AuditEventWriter.java:89)[456:sk.dcom.soa.security:1.0.0.soa-fuse62-SNAPSHOT-34571]
        at com.mycompany.packages.ABC.access$000(AuditEventWriter.java:16)[456:sk.dcom.soa.security:1.0.0.soa-fuse62-SNAPSHOT-34571]
        at com.mycompany.packages.ABC.$1.onMessage(AuditEventWriter.java:63)[456:sk.dcom.soa.security:1.0.0.soa-fuse62-SNAPSHOT-34571]
        at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1396)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:131)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:202)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:133)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:48)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_67]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_67]
        at java.lang.Thread.run(Thread.java:745)[:1.7.0_67]
Caused by: java.lang.ClassNotFoundException: Forbidden class com.mycompany.packages.ABC! This class is not trusted to be serialized as ObjectMessage payload. Please take a look at http://activemq.apache.org/objectmessage.html for more information on how to configure trusted classes.
        at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.checkSecurity(ClassLoadingAwareObjectInputStream.java:110)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:56)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)[:1.7.0_67]
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)[:1.7.0_67]
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)[:1.7.0_67]
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)[:1.7.0_67]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)[:1.7.0_67]
        at org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:206)[189:org.apache.activemq.activemq-osgi:5.11.0.redhat-621107]
        ... 11 more

Environment

  • Red Hat JBoss Fuse
    • 6.2.1

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content