Eclipse:无法连接到远程 VM.拒绝连接.
当我尝试启动我的 Eclipse 调试(用于服务器端代码)时,我收到以下错误 无法连接到远程 VM.连接被拒绝.
可能是什么问题?我已经尝试过网络上的大多数解决方案,但都没有解决我的问题.任何人都可以帮助我解决这个问题吗?提前谢谢..
解决方案你用的是哪台服务器?
如前所述:
- 在您的调试配置中,您必须定义服务器的正确端口 (GF:9009/Tomcat:8000)
- 您必须将服务器的 JVM 属性设置为
debug
对于 Glassfish:
登录 admin-console >配置 >服务器配置>JVM-设置 >检查调试复选框>重启服务器
对于 Tomcat:
在 %TOMCAT_HOME%/bin
目录中创建文件 debug.bat/.sh
(取决于您的操作系统)并写入
设置 JPDA_ADDRESS=8000设置 JPDA_TRANSPORT=dt_socketcatalina.bat jpda 开始
在里面.
创建此文件后,通过执行 debug.bat/.sh 启动服务器.
在调试配置中设置必要的属性后,现在您应该可以在 Eclipse 中进行远程调试了.
希望这有帮助!玩得开心!
编辑
如果您在 Win 环境中将 tomcat 作为服务运行,您没有在 bin 中有 catalina.bat 文件-你的tomcat安装目录.
要将您的服务器设置为调试模式,请尝试以下操作:
- 运行 Windows 菜单中的配置选项或运行
%catalina_home%/bin/tomcat6w.exe
- 在 Java 选项卡中,将此行添加到 Java:
<块引用>
选项:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
When ever i tried to launch my eclipse debug(for server side code) i'm getting the following error Failed to connect to remote VM. Connection refused.
What's the problem may be? I already tried with most of the solutions out in the web but none of that solved my issue. Could any one can assist me to fix this? Advance thanks..
解决方案Which server are you using?
Like already said:
- In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
- You'll have to set the JVM property of the server to
debug
For Glassfish:
Log in to admin-console > Configurations > server-config > JVM-Settings > check DEBUG checkbox > restart server
For Tomcat:
create file debug.bat/.sh
(depending on your OS) in %TOMCAT_HOME%/bin
directory and write
set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
catalina.bat jpda start
in it.
After you've created this file start server by executing debug.bat/.sh.
Now you should be able to debug remotely in Eclipse after you set the necessary properties in your debug configuration.
Hope this helped! Have Fun!
EDIT
If you're running tomcat in a Win environment as a service you don't have a catalina.bat file in the bin-directory of your tomcat installation.
To set your server into debug-mode please try the following:
- Run the Configuration option in Windows Menu or run
%catalina_home%/bin/tomcat6w.exe
- In Java tab, add this line to Java:
options:-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
相关文章