Eclipse : Failed to connect to remote VM. Connection refused.(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
这篇关于Eclipse:无法连接到远程 VM.拒绝连接.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Eclipse:无法连接到远程 VM.拒绝连接.
基础教程推荐
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 在螺旋中写一个字符串 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01