简体   繁体   English

从Scala源代码汇编的远程调试JAR

[英]Remote debug JAR assembled from Scala source code

I am working with an API written in Scala that uses SBT to build it into a JAR file. 我正在使用Scala编写的API进行工作,该API使用SBT将其构建到JAR文件中。 I deploy the JAR file to a virtual machine (VM) and I can execute it successfully - the API starts up and handles requests. 我将JAR文件部署到虚拟机(VM),并且可以成功执行-API启动并处理请求。

Now I am trying to use the IntelliJ (v 2016.3.4) remote-debug configuration to place breakpoints in the source Scala code. 现在,我尝试使用IntelliJ(v 2016.3.4)远程调试配置将断点放置在源Scala代码中。 Here's what I have done: 这是我所做的:

1) Open my source code as a Scala SBT project in IntelliJ . 1)在IntelliJ中打开我的源代码作为Scala SBT项目。

2) Opened VM port 5005 2)打开VM端口5005

3) Executed JAR on VM: 3)在VM上执行JAR:
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. 4)在IntelliJ中添加了远程调试配置并启动了它。 The IntelliJ console shows me this: IntelliJ控制台向我显示了这一点:
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. 我是Scala的新手,多年来没有认真使用Java,只是从IntelliJ开始。

UPDATE : IntelliJ debugger is definitely working - if I pause it, the API stops responding to requests until it becomes un-paused. 更新 :IntelliJ调试器肯定可以正常工作-如果我暂停它,则API会停止对请求的响应,直到它变得未暂停为止。 But no stops on breakpoints. 但是断点没有停止。

Did you specify source code attachments for the JAR you are debugging? 您是否为要调试的JAR指定了源代码附件? In IntelliJ, find the JAR and associate it with the source code. 在IntelliJ中,找到JAR并将其与源代码关联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM