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>

IntelliJ IDEA: Pass M2_HOME to the IDE on OS X Yosemite

I had issues in Yosemite with IntelliJ always complaining that it couldn’t see my M2_HOME variable, even though I had it in my .bash_profile.  Turns out that only works in the terminal.

In any case, this worked — I verified it on my Mac, which runs v10.10.5.

1. Save this plist in ~/Library/LaunchAgents/ as custom.startup.plist



Label
my.startup
ProgramArguments

sh
-c
launchctl setenv VARIABLE_NAME1 VARIABLE_VALUE1 | launchctl setenv VARIABLE_NAME2 VARIABLE_VALUE2 | launchctl setenv VARIABLE_NAME3 VARIABLE_VALUE3

RunAtLoad
2. Log out then back in

3. That's it!

Maven: How to only execute certain Cucumber tags

I needed Maven to only run certain tests that had a specific tag (i.e., @regression).  I couldn’t easily find information via the Cucumber website, so I’m logging it her for archiving.  Note: This command also works in Jenkins via the “Goals and options” section.

clean install -Dcucumber.options="--tags @regression"