ActiveMQ error: “java.lang.RuntimeException: javax.jms.JMSException: Invalid version: 6, could not load org.apache.activemq.openwire.v6.MarshallerFactory”

I was working on a project that needed to send JMS messages to an Apache ActiveMQ broker that was running an older version, specifically, 5.4.x. It started failing with the error below when I switched to it, but had no issues when it was connecting to another broker running 5.9.0.

java.lang.RuntimeException: javax.jms.JMSException: Invalid version: 6, could not load org.apache.activemq.openwire.v6.MarshallerFactory

Note: It could be another version.

I googled to see what the problem was and read that it had to do with a version mismatch between my client and broker. Turned out that I was using 5.9.0, which is why it didn’t conk out with the other broker. Unfortunately, I didn’t have control of the current broker running 5.4.x, so it was back to the drawing board.

Thankfully, I found that ActiveMQ has a legacy dependency that you can use to resolve the issue. Simply add the following and you’ll be good to go:


<dependency>
    <groupId>org.apache.activemq</groupId>
    <artifactId>activemq-openwire-legacy</artifactId>
    <version>5.9.0</version>
</dependency>

One thought on “ActiveMQ error: “java.lang.RuntimeException: javax.jms.JMSException: Invalid version: 6, could not load org.apache.activemq.openwire.v6.MarshallerFactory””

Leave a Reply

Your email address will not be published. Required fields are marked *