Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to extract body.. Forbidden class

I'm playing around with Camel & ActiveMQ trying to bounce around a dummy object between my queues. (No, wouldn't do that in a real case..) However, I'm not allowed to do that with the security restrictions and I really can't figure out why? I read about objectmessage and I can see my changes in AMQ startup

..d:\apache-activemq-5.15.3\bin..\conf\login.config -Dorg.apache.activemq.SERIALIZABLE_PACKAGES=* -Dactivemq.classpath=d ..

And I added this in my connectionfactory

<property name="connectionFactory">
  <bean class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="tcp://localhost:61616"/>
    <property name="trustAllPackages" value="true"/>
  </bean>
</property>

And my Dummy class implemenets Serializable.

Butit still refuses saying:

org.apache.camel.RuntimeCamelException: Failed to extract body due to: 
javax.jms.JMSException: Failed to build body from content.
Serializable class not available to broker. 
Reason: java.lang.ClassNotFoundException: 
Forbidden class camelinaction.Dummy! This class is not trusted to be 
serialized as ObjectMessage payload.

I bet I forgot something simple.. but can't figure it out.

Cheers

like image 202
elwis Avatar asked Jan 20 '26 14:01

elwis


1 Answers

Your setup look OK since you already allow serialization on broker and client.

The only thing I noticed is a small difference between your XML config and the one in the ActiveMQ documentation.

The docs use a classpath that contains a spring package. Your classpath is missing this package. Since the class in the spring package is a subclass of the class you use, it could make a difference, but it is just a wild guess.

class="org.apache.activemq.spring.ActiveMQConnectionFactory"
like image 160
burki Avatar answered Jan 22 '26 06:01

burki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!