Debugger port not opening

偶尔善良 提交于 2019-12-11 14:31:50

问题


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.

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


回答1:


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.

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

Please also note that finding a way to tell gradle to run your jar (in bootRun task) correctly is the more correct way.



来源:https://stackoverflow.com/questions/58581547/debugger-port-not-opening

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!