Blog

IntelliJ IDEA: Getting “Fetch failed. Fatal: Could not read from remote repository”

In case you encounter this issue, do the following:

1. Preferences > SSH
2. Make sure SSH executable is set to “Native.” (If already so, switch to “Built-in,” apply it, then switch back to “Native.”)
3. Happy fetching!

Git: Create a duplicate branch of master

I worked on upgrading a web service from JDK 1.6 to JDK 1.8 and was successful (that’s something I need to write a post on); however, I wanted to make sure I could revert back to pre-1.8 in case it breaks in production. The solution was to create a clone or duplicate of master before I merged the branch.

This would then allow me to merge that branch if needed. Here’s how:


git checkout -b java6-branch origin/master

And then, it needs to be pushed so others can access it:


git push origin java6-branch

That’s it. You can double-check by logging into your Git site. :)

P.S. Best practice is to name your branches in lowercase and in groupings (i.e. foo/bar1, foo/bar2).

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>