0

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

我知道它失败的原因是 jar,但我已经放置了所有最新的 jar,但它仍然失败。现在我不知道该怎么办?

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

4

2 回答 2

0

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

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

于 2018-06-11T12:53:30.753 回答
0

有几个可用的 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 的 String 版本。

于 2018-11-22T04:30:56.290 回答