0
votes

I am working with an API written in Scala that uses SBT to build it into a JAR file. I deploy the JAR file to a virtual machine (VM) and I can execute it successfully - the API starts up and handles requests.

Now I am trying to use the IntelliJ (v 2016.3.4) remote-debug configuration to place breakpoints in the source Scala code. Here's what I have done:

1) Open my source code as a Scala SBT project in IntelliJ .

2) Opened VM port 5005

3) Executed JAR on VM:
java -noverify "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005" -cp /home/vagrant/shared/build/geotrellis-chatta-demo-assembly-0.1-SNAPSHOT.jar geotrellis.chatta.Main

I get this output:
Listening for transport dt_socket at address: 5005

4) Added a remote-debug configuration in IntelliJ and started it. The IntelliJ console shows me this:
Connected to the target VM, address: 'localhost:5005', transport: 'socket'

However, none of my breakpoints work.

Am I missing something in the above steps? I'm very new to Scala, haven't worked with Java seriously in years, and am just starting with IntelliJ.

UPDATE: IntelliJ debugger is definitely working - if I pause it, the API stops responding to requests until it becomes un-paused. But no stops on breakpoints.

1
Is the jar built with debugging info included? You can't set breakpoints without having line numbers. The answer to this post has some info to figure this out. - jkinkead
Consider using method breakpoints. - Thorbjørn Ravn Andersen
Did you specify source code attachments for the JAR you are debugging? In IntelliJ, find the JAR and associate it with the source code - radumanolescu
@radumanolescu - that was it. If you repost your comment as an answer I would be happy to accept it. Thanks very much - rgwozdz
@rgwozdz Added answer below - radumanolescu

1 Answers

0
votes

Did you specify source code attachments for the JAR you are debugging? In IntelliJ, find the JAR and associate it with the source code.