简体   繁体   English

调试-IntelliJ无法连接到远程服务器上启用调试的JVM

[英]Debugging - IntelliJ can not connect to debug enabled JVM on a remote server

I have a typical in-house cluster with a login node and multiple compute nodes. 我有一个典型的内部群集,其中包含一个登录节点和多个计算节点。 For a start, I ran a JVM instance with the following params to let my IntelliJ debugger connect to it. 首先,我运行了一个带有以下参数的JVM实例,以使我的IntelliJ调试器连接到该实例。

-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

This login node has a pubically accessible address which I mostly ssh into to launch jobs. 这个登录节点有一个公共可访问的地址,我主要将其登录以启动作业。 However, when I try to attach my IntelliJ debugger to a JVM instance on this node, the connection just times it and it is unable to connect while my JVM instance is indeed launched in the suspended mode waiting for the debugger to connect to it. 但是,当我尝试将IntelliJ调试器附加到此节点上的JVM实例时,连接只是对其进行计时,并且在我的JVM实例确实以挂起模式启动时等待调试器连接时,它无法连接。

IntelliJ远程调试配置

Update: The initial problem seemed to be that I get not access any other port on my server other than port 22 which I use to SSH into it. 更新:最初的问题似乎是我无法访问服务器上除用于SSH进入的端口22以外的任何其他端口。 Anyhow, I was able to create a SOCK5 proxy, configured IntelliJ to use that proxy and then successfully test the connection as well as shown below: 无论如何,我能够创建一个SOCK5代理,将IntelliJ配置为使用该代理,然后成功测试连接,如下所示:

在主机上测试连接:调试器正在侦听的端口

The output on the debugger console shows that IntelliJ was successfully able to access that port on the specified hostname, albiet with an HTTP request and not a JWP one. 调试器控制台上的输出显示IntelliJ能够成功访问指定主机名上的该端口,只是通过HTTP请求而不是JWP访问。

调试器控制台输出

However, when I then proceed to connect the debugger to the same host:port combination, I am unable to do so and get the following error: 但是,当我继续将调试器连接到相同的host:port组合时,我无法这样做并出现以下错误:

调试器错误

I have also tried setting suspend=n but to no avail. 我也尝试过设置suspend=n但无济于事。

ssh -L 5005:localhost:5005 haseeb@myserver.com

will map localhost:5005 to port 5005 on myserver.com (also on localhost interface of myserver.com ). 将映射localhost:5005到端口5005myserver.com (还localhost的接口myserver.com )。 This way in IntelliJ IDEA debugger you will be connecting to localhost (specify it in the Host field) port 5005 and the connection will be forwarded to the remote server where debugger listens on localhost:5005 . 这样,在IntelliJ IDEA调试器中,您将连接到localhost (在“ 主机”字段中指定)端口5005 ,并且连接将转发到调试器在localhost:5005上侦听的远程服务器。

See here for more details how SSH tunnels work 有关更多详细信息,请参见此处

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

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