此问题的解决方法是通过设置系统属性activemq.util. activemq.classpath.allowAll,以告诉ActiveMQConnectionFactory扫描所有类以查找相关的包。代码示例如下:
System.setProperty("activemq.util. activemq.classpath.allowAll", "true"); ConnectionFactory factory = new ActiveMQConnectionFactory("tcp://localhost:61616");