0

In our application we are creating queues by using plain java code below, but sometimes this get failed cause of following error.

I have clue that it fails cause of jar but i have placed all latest jar but still it is failing . Now I have no idea what to do?

Activemq startup code:

            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

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

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
user9923492
  • 1
  • 1
  • 1

2 Answers2

0

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. 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.

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

Tim Bish
  • 17,475
  • 4
  • 32
  • 42
  • Thanks Tim but we are using jdk8 only. although these jars won't work in lower jdk versions – user9923492 Jun 12 '18 at 07:34
  • Your problem is either that you are using wrong JDK versions or you are mixing different versions of ActiveMQ jars, you'd need to figure that out on your own as only you have that sort of access – Tim Bish Jun 12 '18 at 13:33
0

There are several ActiveMQConnectionFactory ctors available. 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. You can pass a bind address of "tcp://localhost:61616" to the String version of the ctor.

Richard Jessop
  • 897
  • 1
  • 12
  • 19