ActiveMQ发送ObjectMessage [英] ActiveMQ send ObjectMessage

查看:242
本文介绍了ActiveMQ发送ObjectMessage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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.

错误消息:


该类不允许序列化。添加具有 org.apache.activemq.SERIALIZABLE_PACKAGES系统属性的软件包

This class is not allowed to be serialized. Add package with 'org.apache.activemq.SERIALIZABLE_PACKAGES' system property


推荐答案

或者在运行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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆