Tuesday, May 2, 2017

One simple command and voila ...

I have been trying to get IntelliJ IDEA's debugger working with Scala (support via plugin) for the better part of this past week.  Each time the debugger was launched, I hit an issue that presented itself as a runtime exception: ClassNotFoundException for: org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.

My initial guess was "JAR Hell".  The best trick I found for debugging library dependency issues is using sbt-depdency-graph plugin to visualize the dependency tree using sbt.  To make use of the plugin you you need to add the following line to your plugins.sbt file.  Use command sbt dependencyTree to view the output (library dependency tree) of the plugin.

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")

Turns it that it wasn't a library dependency issue.  This is the hint that finally unblocked me:

Connected to the target VM, address: '', transport: 'socket'

Luckily enough, I knew that something was up with my firewall as my Jenkins instance was no longer accepting connections.  I had yet to debug this.  On further inspection, I found my workstation's firewall rules had been completely wiped.  The effect was no local TCP connections werepossible.  The simple solution was to re-add the loopback network interface (lo) to firewalld and apply the trusted firewall zone to it.  The not-so-simple solution, aka. the one that I first tried, was to identify the ports that IDEA's Scala plugin uses for local remote debugging.  It turns out the port choice is random, thus the simple solution.

% firewall-cmd --zone=trusted --add-interface=lo --permanent

The debugger works fine now.

No comments:

Post a Comment