eclipse eclipse远程调试

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4346018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 15:26:40  来源:igfitidea点击:

Remote Debugging in eclipse

javaeclipsedebugging

提问by Dheeraj Joshi

I have an application running in server A. The dev environment is in server B. I am trying to do remote debugging of app running in server A.

我有一个在服务器 A 中运行的应用程序。开发环境在服务器 B 中。我正在尝试对在服务器 A 中运行的应用程序进行远程调试。

In server A i added following command to service start script

在服务器 A 中,我将以下命令添加到服务启动脚本

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

And service is running in server A.

并且服务正在服务器 A 中运行。

When i try to launch remote debugging configuration it gives

当我尝试启动远程调试配置时,它给出

Failed to connect to remote VM. Connection refused. Connection refused

port 4554 is free in server A.

服务器 A 中的端口 4554 是空闲的。

What other configuration need to be done for this?

为此还需要做哪些其他配置?

Regards Dheeraj Joshi

问候 Dheeraj Joshi

回答by Martin Algesten

Try this.

尝试这个。

  1. Set suspend=y, just to make sure you got the JVM line right. This should stop the VM on startup until you connect.
  2. If you're on Unix, bring up the terminal and try telnet [host] [port]- this will quickly let you know if there's anything listening to that port on that host.
  3. Make sure the connection properties in Eclipse are set correctly. Note that the port defaults to 8000.
  4. Use the IP address instead of the host name, to rule out DNS/hostfile problems.
  1. Set suspend=y,只是为了确保你的 JVM 行正确。这应该会在启动时停止 VM,直到您连接为止。
  2. 如果您使用的是 Unix,请打开终端并尝试telnet [host] [port]- 这将很快让您知道是否有任何东西在该主机上侦听该端口。
  3. 确保 Eclipse 中的连接属性设置正确。请注意,端口默认为 8000。
  4. 使用 IP 地址而不是主机名,以排除 DNS/主机文件问题。

Run properties in eclipse

在 Eclipse 中运行属性

Another way of starting the JVM that I use successfully is:

启动我成功使用的 JVM 的另一种方法是:

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

回答by snowflake

Check if there is a firewall between and/or on the two servers.

检查两台服务器之间和/或两台服务器上是否有防火墙。