简体   繁体   English

从ActiveMQ连接工厂创建连接时,ActiveMQ在启动时失败

[英]Activemq is failing at startup while creating connection from activemq connection factory

In our application we are creating queues by using plain java code below, but sometimes this get failed cause of following error. 在我们的应用程序中,我们使用下面的纯Java代码创建队列,但是有时这会导致以下错误的失败原因。

I have clue that it fails cause of jar but i have placed all latest jar but still it is failing . 我有线索说它不能引起jar的问题,但是我已经放置了所有最新的jar,但是仍然失败了。 Now I have no idea what to do? 现在我不知道该怎么办?

Activemq startup code : 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();

Error 错误

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 used 使用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

You would get this error if one of the libraries you are using is built using a JDK version that is newer than the one you are running it on. 如果正在使用的一个库是使用比运行它的库新的JDK版本构建的,则会出现此错误。 Since that info is not in the question it is hard to guess for sure which one. 由于该信息不存在问题,因此很难确定哪个。 I'd check that your JDK matches the required version of all the libraries you are using. 我会检查您的JDK是否与您正在使用的所有库的必需版本相匹配。

The 5.15.x version of ActiveMQ requires JDK 8 so my guess is you are trying to run it on JDK 7 or earlier ActiveMQ的5.15.x版本需要JDK 8,所以我想您正在尝试在JDK 7或更早版本上运行它。

There are several ActiveMQConnectionFactory ctors available. 有几个可用的ActiveMQConnectionFactory ctor。 Without drafting an epistle of completeness, I use the following: 在不起草完整的书信的情况下,我使用以下内容:

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

The bind address specifies the transport, the host (or IP address), and the port. 绑定地址指定传输,主机(或IP地址)和端口。 You can pass a bind address of "tcp://localhost:61616" to the String version of the ctor. 您可以将绑定地址“ tcp:// localhost:61616”传递给ctor的String版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM