SSH隧道 - 远程调试

时间:2015-09-06 13:14:28

标签: eclipse remote-debugging ssh-tunnel

我可以在服务器上输入端口22上的abc.xyz,但我无法在Eclipse中远程调试它。以下是其他信息:

服务器启动参数 -

-Xdebug -Xrunjdwp:transport=dt_socket,address=1234,server=y,suspend=n

日志确认 -

Listening for transport dt_socket at address: 1234

当我在本地系统上telnet时 -

local-machine% telnet abc-xyz 1234
Trying xx.xx.xx.xx...
telnet: connect to address xx.xx.xx.xx: Connection timed out
telnet: Unable to connect to remote host: Connection timed out

当我在服务器上telnet(abc.xyz) -

abc-xyz% telnet localhost 1234
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
Connection closed by foreign host.

我尝试通过 -

设置隧道
  1. ssh -L 1234:localhost:1234 user@abc-xyz
  2. ssh -L 1234:127.0.0.1:1234 user@abc-xyz
  3. 我在Eclipse中使用此配置附加调试器 -

    Connection type - Standard (Socket attach)
    Host - localhost
    Port - 1234
    

    无法让Eclipse连接到1234。

    设置SSH隧道后,如果我手动尝试连接到端口,我会收到此响应 -

    local-machine% telnet localhost 1234
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    Connection closed by foreign host.
    

    我在catalina.out中看到一个条目:

      

    频道4:开启失败:连接失败:拒绝连接

    任何帮助都将不胜感激。

    编辑 - 1:

    我跑了

    abc-xyz% ~#
    

    并获得以下输出:

    The following connections are open:
      #2 client-session (t4 r0 i0/0 o0/0 fd 7/8 cc -1)
      #3 direct-tcpip: listening port 1234 for localhost port 1234, connect from 127.0.0.1 port 23456 (t4 r1 i0/0 o0/0 fd 10/10 cc -1)
    

    我认为ssh隧道工作正常,这就是我与Eclipse连接的方式,这里出错了。

1 个答案:

答案 0 :(得分:0)

我只是需要增加超时。 (可以通过Window-> Preferences-> Java-> Debugging来完成。将它设置为某个适当的值。)