I am trying to add my package as trusted for (de)serialization in activemq.
I am using Mongo 3.0.1 so BsonArray.parse(...)
is not an option.
I tried System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES","*");
but that is being ignored. From this, setting it in spring/camel overrides the system properties.
This configuration will override system properties if they are set.
Copy-pasting the following from the same link into my blueprint.xml caused a bunch of "amq-broker" errors that required reinstalling everything from scratch to fix and I'm afraid to try again to get the error message.
<bean id="connectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
<property name="trustAllPackages" value="true"/>
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="connectionFactory"/>
</bean>
<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
So, in Karaf/ServiceMix, what is the proper way of adding trusted packages to activemq?
Related question, but System Properties doesn't work for me, and I don't know where ActiveMQ config is in Karaf.
I figured out my problem. The reason System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES","*");
in my activator doesn't work, is because ActiveMQ only reads org.apache.activemq.SERIALIZABLE_PACKAGES
on startup, and ActiveMQ gets started before my bundle in Karaf.
I'm not sure how to restart ActiveMQ from my activator to force it to pickup the changes at run-time, but you can set org.apache.activemq.SERIALIZABLE_PACKAGES=*
manually in <Karaf-home>/etc/system.properties
. That will set the property for you before ActiveMQ starts so that ActiveMQ receives your configuration. Note that after changing the system.properties file, you will need to restart Karaf for the changes to take effect.