Eclipse:无法连接到远程 VM.拒绝连接. [英] Eclipse : Failed to connect to remote VM. Connection refused.

查看:48
本文介绍了Eclipse:无法连接到远程 VM.拒绝连接.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试启动我的 Eclipse 调试(用于服务器端代码)时,我收到以下错误 无法连接到远程 VM.连接被拒绝.

可能是什么问题?我已经尝试过网络上的大多数解决方案,但都没有解决我的问题.任何人都可以帮助我解决这个问题吗?提前谢谢..

解决方案

你用的是哪台服务器?

如前所述:

  1. 在您的调试配置中,您必须定义服务器的正确端口 (GF:9009/Tomcat:8000)
  2. 您必须将服务器的 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安装目录.
要将您的服务器设置为调试模式,请尝试以下操作:

  1. 运行 Windows 菜单中的配置选项或运行 %catalina_home%/bin/tomcat6w.exe
  2. 在 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:

  1. In your debug configuration you'll have to define the right port of your server (GF:9009 / Tomcat:8000)
  2. 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:

  1. Run the Configuration option in Windows Menu or run %catalina_home%/bin/tomcat6w.exe
  2. In Java tab, add this line to Java:

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

这篇关于Eclipse:无法连接到远程 VM.拒绝连接.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆