问题描述
我正在使用ActiveMQ在当前项目中实施消息传递系统。我需要发送和接收Java对象,而不是简单的文本或二进制消息。 Java对象(我的消息对象)根据需要实现Serializable接口。
I'm using ActiveMQ to implement a messaging system in my current project. I need to send and receive Java objects instead of simple text or binary messages. The Java object (my message object) implements the Serializable interface as required.
ActiveMQ的最新版本增加了一些安全性,我需要使用允许的软件包将属性设置为,但我没有设法使其正常运行。我不确定该属性需要添加到哪里。
Recent versions of ActiveMQ added some security and I need to set a property with the allowed packages as described here, but I haven't managed to make it work. I'm not sure where that property needs to be added.
错误消息:
推荐答案
或者在运行jar时在环境变量中传递受信任的程序包,或者可以通过添加以下代码行以编程方式执行此操作:
You need to either pass trusted packages in environment variable while running jar or you can do this programmatically by adding following line of code:
System.setProperty("org.apache.activemq.SERIALIZABLE_PACKAGES","*");
我希望这会有所帮助
这篇关于ActiveMQ发送ObjectMessage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!