调试器端口未打开 [英] Debugger port not opening
问题描述
由于某些原因,当我从intellij运行我的Spring应用程序时,某些任务没有执行,因为我的存根服务器响应错误,所以我尝试通过项目中预先编写的go脚本启动它,但它能正常工作. 但是现在附加调试器成为一个问题,因为我已经从终端启动了我的应用程序.
For some reason when i run my Spring application from intellij some task is not being executed because of which my stub server responds with a error.So i tried to start it through a pre-written go script in my project and it worked. But now attaching debugger becomes a problem because i have started my application from terminal.
我尝试通过在intellij中设置远程配置并将端口设置为8000来进行远程调试,但是我一直收到错误消息连接被拒绝"
I tried doing a remote debug by setting a remote configuration in intellij and setting the port as 8000 but i keep getting the error "Connection refused"
以下是远程配置屏幕截图: 远程配置屏幕截图
Below is the remote configuration screenshot: Remote config screenshot
这是为通过终端启动的应用程序附加调试器的正确方法吗?
Is this the correct approach to attach debugger for an app started through terminal?
以调试模式启动的命令:
Command to start in debug mode:
gradle bootRun
-Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8080
gradle bootRun
-Dagentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8080
推荐答案
另一种简便的方法是打开Run anything
窗口(Ctrl/Command + shift + A),然后搜索attach debugger
操作. IntelliJ将尝试查找附加了调试器的任何进程,并显示一个列表,您可以从中选择要附加到的进程.
The alternative and easier way is opening the Run anything
window (ctrl/command + shift + A) and then searching for attach debugger
action. IntelliJ will try to find any processes that have debugger attached, and will display a list from which you can choose which process to attach to.
假设您获得了java.lang.module.FindException
,则还可以尝试运行gradle bootJar
,然后通过
Provided that you get java.lang.module.FindException
, you might also try to run gradle bootJar
and then run the generated jar (in build/libs
directory) file by
java "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8080" --add-exports java.base/jdk.hotspot.agent=ALL-UNNAMED -jar my_jar.jar
也请注意,找到一种方法来告诉gradle正确运行jar(在bootRun任务中)是更正确的方法.
Please also note that finding a way to tell gradle to run your jar (in bootRun task) correctly is the more correct way.
这篇关于调试器端口未打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!