You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by MMA_EDFX <ma...@edifixio.com> on 2016/06/22 08:52:43 UTC

TomEE 7 with ActiveMQ 5.13.3 : Class is not trusted to be serialized as ObjectMessage payload

Hello, 
        I am getting the below error while posting the message to jms queue. 
I have gone through the link http://activemq.apache.org/objectmessage.html
provided in the error message. But I could not resolve the issue. 

How do I resolve this issue?

I am using TomEE 7.0 server 

1) I have added this in Tomee 7.0's catalina.bat file. 

set ALL_PACKAGE="*" 
set JAVA_OPTS = %JAVA_OPTS%
-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=%ALL_PACKAGE% 

2)This is my activemq.xml file. 

    
<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.13.3.xsd">
        
        <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                <property name="properties">
                        <props>
                                <prop key="data.dir">data</prop>
                        </props>
                </property>
        </bean>

        <broker xmlns="http://activemq.apache.org/schema/core" useJmx="true" 
                brokerName="localhost" useShutdownHook="false"
persistent="true" 
                start="true" schedulerSupport="false"
enableStatistics="false" 
                offlineDurableSubscriberTimeout="259200000" 
                offlineDurableSubscriberTaskSchedule="3600000">

                <destinations>
                        <queue physicalName="entryPointSiretailQueue" />
                </destinations>


                <persistenceAdapter>
                        <kahaDB directory="${data.dir}/activemq-data/kaha" 
                                indexCacheSize="20000"
ignoreMissingJournalfiles="true" 
                                checkForCorruptJournalFiles="true"
checksumJournalFiles="true" />
                </persistenceAdapter>

                <systemUsage>
                        <systemUsage>
                                <memoryUsage>
                                        <memoryUsage limit="64 mb" />
                                </memoryUsage>
                                <storeUsage>
                                        <storeUsage limit="10 gb" />
                                </storeUsage>
                        </systemUsage>
                </systemUsage>

                
                <transportConnectors>
                        
                        <transportConnector name="vm" 
                               
uri="vm://localhost:16013/localhost?waitForStart=30000&amp;async=true" />
                </transportConnectors>
        </broker>
</beans>

3)This is my JMS config defined in tomee.xml file: 

<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
        BrokerXmlConfig  = xbean:activemq.xml 
        ServerUrl = vm://localhost:61616 
</Resource>
        
<Resource id="JMSConnectionFactory" type="javax.jms.QueueConnectionFactory">
                connectionMaxIdleTime = 15 Minutes 
                connectionMaxWaitTime = 5 seconds 
                ResourceAdapter = MyJmsResourceAdapter 
                poolMaxSize = 10 
                poolMinSize = 0 
                transactionSupport = xa 
</Resource>

4)This is the error I am getting while posting message to the queue. 

javax.jms.JMSException: Failed to build body from content. Serializable
class not available to broker. Reason: java.lang.ClassNotFoundException:
Forbidden class com.edifixio.osrd.service.middleoffice.MiddleOfficeMessage!
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) 
        at
org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:208) 
        at
com.senoble.siretail.service.entrypointsiretail.EntryPointSiretailServiceImpl.dealWithMessageUniqueDelivery(EntryPointSiretailServiceImpl.java:80) 
        ... 31 more 
Caused by: java.lang.ClassNotFoundException: Forbidden class
com.edifixio.osrd.service.middleoffice.MiddleOfficeMessage! 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:112) 
        at
org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:57) 
        at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612) 
        at
java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517) 
        at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771) 
        at
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350) 
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370) 
        at
org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:206) 
        ... 32 more



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-7-with-ActiveMQ-5-13-3-Class-is-not-trusted-to-be-serialized-as-ObjectMessage-payload-tp4678995.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE 7 with ActiveMQ 5.13.3 : Class is not trusted to be serialized as ObjectMessage payload

Posted by MMA_EDFX <ma...@edifixio.com>.
Hello,
        Yes you are right. I added it in the wrong place, which is not
called.

Now I added after the line 

rem Add OpenEJB javaagent 

set ALL_PACKAGE_OPTS="-Dorg.apache.activemq.SERIALIZABLE_PACKAGES=*" 
set JAVA_OPTS=%JAVA_OPTS% %ALL_PACKAGE_OPTS% 

It looks be ok now.

Thanks



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/TomEE-7-with-ActiveMQ-5-13-3-Class-is-not-trusted-to-be-serialized-as-ObjectMessage-payload-tp4678995p4679002.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: TomEE 7 with ActiveMQ 5.13.3 : Class is not trusted to be serialized as ObjectMessage payload

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hello

this is the way to solve it - and actually how we fixed our tests upgrading
AMQ version.

you maybe didn't add it in the right place in catalina.bat. I would
recommand you to use setenv.bat in bin folder for such config or use
conf/system.properties


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://blog-rmannibucau.rhcloud.com> | Old Wordpress Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com> | JavaEE Factory
<https://javaeefactory-rmannibucau.rhcloud.com>

2016-06-22 10:52 GMT+02:00 MMA_EDFX <ma...@edifixio.com>:

> Hello,
>         I am getting the below error while posting the message to jms
> queue.
> I have gone through the link http://activemq.apache.org/objectmessage.html
> provided in the error message. But I could not resolve the issue.
>
> How do I resolve this issue?
>
> I am using TomEE 7.0 server
>
> 1) I have added this in Tomee 7.0's catalina.bat file.
>
> set ALL_PACKAGE="*"
> set JAVA_OPTS = %JAVA_OPTS%
> -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=%ALL_PACKAGE%
>
> 2)This is my activemq.xml file.
>
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>         xmlns:amq="http://activemq.apache.org/schema/core"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xsi:schemaLocation="http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
> http://activemq.apache.org/schema/core
> http://activemq.apache.org/schema/core/activemq-core-5.13.3.xsd">
>
>         <bean
>
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>                 <property name="properties">
>                         <props>
>                                 <prop key="data.dir">data</prop>
>                         </props>
>                 </property>
>         </bean>
>
>         <broker xmlns="http://activemq.apache.org/schema/core"
> useJmx="true"
>                 brokerName="localhost" useShutdownHook="false"
> persistent="true"
>                 start="true" schedulerSupport="false"
> enableStatistics="false"
>                 offlineDurableSubscriberTimeout="259200000"
>                 offlineDurableSubscriberTaskSchedule="3600000">
>
>                 <destinations>
>                         <queue physicalName="entryPointSiretailQueue" />
>                 </destinations>
>
>
>                 <persistenceAdapter>
>                         <kahaDB directory="${data.dir}/activemq-data/kaha"
>                                 indexCacheSize="20000"
> ignoreMissingJournalfiles="true"
>                                 checkForCorruptJournalFiles="true"
> checksumJournalFiles="true" />
>                 </persistenceAdapter>
>
>                 <systemUsage>
>                         <systemUsage>
>                                 <memoryUsage>
>                                         <memoryUsage limit="64 mb" />
>                                 </memoryUsage>
>                                 <storeUsage>
>                                         <storeUsage limit="10 gb" />
>                                 </storeUsage>
>                         </systemUsage>
>                 </systemUsage>
>
>
>                 <transportConnectors>
>
>                         <transportConnector name="vm"
>
> uri="vm://localhost:16013/localhost?waitForStart=30000&amp;async=true" />
>                 </transportConnectors>
>         </broker>
> </beans>
>
> 3)This is my JMS config defined in tomee.xml file:
>
> <Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
>         BrokerXmlConfig  = xbean:activemq.xml
>         ServerUrl = vm://localhost:61616
> </Resource>
>
> <Resource id="JMSConnectionFactory"
> type="javax.jms.QueueConnectionFactory">
>                 connectionMaxIdleTime = 15 Minutes
>                 connectionMaxWaitTime = 5 seconds
>                 ResourceAdapter = MyJmsResourceAdapter
>                 poolMaxSize = 10
>                 poolMinSize = 0
>                 transactionSupport = xa
> </Resource>
>
> 4)This is the error I am getting while posting message to the queue.
>
> javax.jms.JMSException: Failed to build body from content. Serializable
> class not available to broker. Reason: java.lang.ClassNotFoundException:
> Forbidden class com.edifixio.osrd.service.middleoffice.MiddleOfficeMessage!
> 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)
>         at
>
> org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:208)
>         at
>
> com.senoble.siretail.service.entrypointsiretail.EntryPointSiretailServiceImpl.dealWithMessageUniqueDelivery(EntryPointSiretailServiceImpl.java:80)
>         ... 31 more
> Caused by: java.lang.ClassNotFoundException: Forbidden class
> com.edifixio.osrd.service.middleoffice.MiddleOfficeMessage! 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:112)
>         at
>
> org.apache.activemq.util.ClassLoadingAwareObjectInputStream.resolveClass(ClassLoadingAwareObjectInputStream.java:57)
>         at
> java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
>         at
> java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
>         at
> java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
>         at
> java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
>         at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
>         at
>
> org.apache.activemq.command.ActiveMQObjectMessage.getObject(ActiveMQObjectMessage.java:206)
>         ... 32 more
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/TomEE-7-with-ActiveMQ-5-13-3-Class-is-not-trusted-to-be-serialized-as-ObjectMessage-payload-tp4678995.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>