Hello, This config need to be done on the clients side and on the activemq side , the serialized classes must be on the classpath of the producer and consumer, i think on the broker side too to unmarshal received object no ? You need to check these conditions.
You use TomEE for deploying the client ? Please verify your config as said in the link you provided, this for the broker side and not the better for client : If you need to exchange object messages, you need to add packages your applications are using. You can do that with by using org.apache.activemq.SERIALIZABLE_PACKAGES system property of the broker. You can add this system property to ACTIVEMQ_OPTS variable... For client side it's better with setTrustedPackages() method as mentioned in the link. Don't forget the security constraints. Hassen. Le 21 juin 2016 18:16, "MMA_EDFX" <[email protected]> a écrit : > > 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. > > 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&async=true"/> > > > </transportConnectors> > > </broker> > </beans> > > 3)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://activemq.2283324.n4.nabble.com/ActiveMQ-5-13-3-Class-is-not-trusted-to-be-serialized-as-ObjectMessage-payload-tp4713199.html > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
