无法连接到远程 VM。拒绝连接。尝试在 Flash Builder 4.7 中调试远程 Java 应用程序时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18599256/
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-08-12 09:22:33  来源:igfitidea点击:

Failed to connect to remote VM. Connection refused. when trying to debug remote java application in Flash Builder 4.7

javaeclipseapache-flexflash-builderflexbuilder

提问by Monte Chan

At one point, the remote debug used to work. But for the life of me, I don't seem to be able to figure out what broke it.

在某一时刻,远程调试曾经可以工作。但对于我的生活,我似乎无法弄清楚是什么打破了它。

I have a flex/Java application. There is a wrapper that starts the tomcat server. I modified the wrapper.conf file to include

我有一个 flex/Java 应用程序。有一个包装器可以启动 tomcat 服务器。我修改了 wrapper.conf 文件以包含

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

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

In my flex debug configurations, on the left, I have Remote Java Application. On the right, I have Standard (Socket Attach) as the connection type, 127.0.0.1 (I have tried localhost too) as Host, and 8000 as Port.

在我的 flex 调试配置中,左侧是远程 Java 应用程序。在右侧,我将标准(套接字连接)作为连接类型,将 127.0.0.1(我也尝试过 localhost)作为主机,将 8000 作为端口。

The following is the stack trace.

以下是堆栈跟踪。

!ENTRY org.eclipse.jdt.launching 4 113 2013-09-03 11:30:49.109 !MESSAGE Failed to connect to remote VM. Connection refused. !STACK 0 java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.(Unknown Source) at java.net.Socket.(Unknown Source) at org.eclipse.jdi.internal.connect.SocketTransportService$2.run(SocketTransportService.java:136) at java.lang.Thread.run(Unknown Source)

!ENTRY org.eclipse.jdt.launching 4 113 2013-09-03 11:30:49.109 !MESSAGE 无法连接到远程 VM。拒绝连接。!STACK 0 java.net.ConnectException: 连接被拒绝:在 java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.PlainSocketImpl.doConnect(Unknown Source) at java.net.PlainSocketImpl.connectToAddress(Unknown Source) at java.net.PlainSocketImpl.socketConnect(Native Method) 连接java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java。 net.Socket.(Unknown Source) at java.net.Socket.(Unknown Source) at org.eclipse.jdi.internal.connect.SocketTransportService$2.run(SocketTransportService.java:136) at java.lang.Thread.run(来源不明)

Here is a screen shot of the debug configurations. screen shot of the debug configurations

这是调试配置的屏幕截图。 调试配置的屏幕截图

采纳答案by Monte Chan

After much struggles, I finally got it figured out. I had to make two changes.

经过一番折腾,我终于弄明白了。我不得不做两个改变。

  1. I added tomcat.enable.debug=true to my catalina.properties file.
  2. In my wrapper.conf, I had the following lines.

    wrapper.java.additional.9="-Xmx2048m" wrapper.java.additional.10="-XX:MaxPermSize=1024m"

  1. 我将 tomcat.enable.debug=true 添加到我的 catalina.properties 文件中。
  2. 在我的 wrapper.conf 中,我有以下几行。

    wrapper.java.additional.9="-Xmx2048m" wrapper.java.additional.10="-XX:MaxPermSize=1024m"

My MaxPermSize was set to a smaller size than Xmx. I had to change that 1024 to 2048.

我的 MaxPermSize 设置为比 Xmx 更小的尺寸。我不得不将那个 1024 更改为 2048。

I then restarted my tomcat and it worked, finally!

然后我重新启动了我的 tomcat,它终于成功了!

回答by BenMalik

Each debug argument must be placed in a line by itself, after the -vm argument. This should do the trick:

每个调试参数必须单独放在一行中,在 -vm 参数之后。这应该可以解决问题:

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

回答by Dilip M D

Eclipse is not very verbose for this error "Connection refused". One has to check three entries here.
1. Fully qualified host name or IP
2. Correct port number.
3. At Tomcat level heck below:

Eclipse 对于这个错误“连接被拒绝”并不是很详细。必须在这里检查三个条目。
1. 完全限定的主机名或 IP
2. 正确的端口号。
3. 在下面的 Tomcat 级别:

Some versions of Tomcat has "dt_shmem" entry instead of "dt_socket". Change it to dt_socket in catalina.bat. The line should looks like this:
set JPDA_TRANSPORT=dt_socket

某些版本的 Tomcat 具有“dt_shmem”条目而不是“dt_socket”。在 catalina.bat 中将其更改为 dt_socket。该行应如下所示:
set JPDA_TRANSPORT=dt_socket

回答by Mustafa Kemal

We must start Tomcat in remote mode rightly, otherwise just setting related variable cannot solve the problem. My solution is below and that works for my situation: Connection refused problem solution

一定要正确地以远程方式启动Tomcat,否则仅仅设置相关变量是无法解决问题的。我的解决方案如下,适用于我的情况: 连接拒绝问题解决方案

回答by committedandroider

If you validate Eclipse configuration settings and see that both hostname/IP and port name are correct, try to restart eclipse

如果您验证 Eclipse 配置设置并看到主机名/IP 和端口名称都正确,请尝试重新启动 Eclipse