Activemq 在启动时失败,同时从 activemq 连接工厂创建连接



在我们的应用程序中,我们使用下面的纯java代码创建队列,但有时这会导致以下错误。

我知道它失败了,因为罐子,但我已经放置了所有最新的罐子,但它仍然失败了.现在我不知道该怎么办?

Activemq 启动代码

qconFactory = new ActiveMQConnectionFactory("My.Queue");        
qcon = qconFactory.createConnection(); //error occurs here
session = qcon.createSession(false, Session.AUTO_ACKNOWLEDGE);
destination = session.createQueue(QUEUE_NAME);  
producer = session.createProducer(destination);
consumer = session.createConsumer(destination);
msg = session.createTextMessage();
consumer.setMessageListener(new ImportMessageDrivenBean());
qcon.start();

错误

javax.jms.JMSException: Could not create Transport. Reason: java.lang.RuntimeException: Fatally failed to create SystemUsageInvalid version: 11, org.apache.activemq.openwire.v11.MarshallerFactory does not properly implement the createMarshallerMap method.

使用的 JAR

activemq-broker-5.15.4.jar

activemq-client-5.15.4.jar

activemq-jaas-5.15.4.jar

activemq-kahadb-store-5.15.4.jar

activemq-openwire-legacy-5.15.4.jar

activemq-protobuf-1.1.jar

geronimo-j2ee-management_1.1_spec-1.0.1.jar

geronimo-jms_1.1_spec-1.1.1.jar

geronimo-jta_1.0.1B_spec-1.0.1.jar

slf4j-api-1.7.25.jar

如果您正在使用的某个库是使用比运行它的库更新的 JDK 版本构建的,则会收到此错误。 由于该信息不在问题中,因此很难确定是哪一个。 我会检查您的 JDK 是否与您正在使用的所有库的所需版本匹配。

ActiveMQ 的 5.15.x 版本需要 JDK 8,所以我猜您正在尝试在 JDK 7 或更早版本上运行它

有几个 ActiveMQConnectionFactory ctor 可用。 在没有起草完整书信的情况下,我使用以下内容:

String bindAddress = "failover:tcp://localhost:61616"; // failover promotes resilience URI uRI = new URI(bindAddress); ConnectionFactory factory = new ActiveMQConnectionFactory(uRI); // note the more general ConnectionFactory

绑定地址指定传输、主机(或 IP 地址(和端口。 您可以将绑定地址"tcp://localhost:61616"传递给 ctor 的字符串版本。

最新更新