如何从 Eclipse 调试远程 Glassfish Web 应用程序?

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

How to debug remote Glassfish web app from Eclipse?

eclipseglassfish

提问by Robin Green

The web app I'm trying to debug only exhibits a bug on a particular Glassfish server, so I want to debug the web app remotely. But the web app was developed in Eclipse for Java SE and I can't see how to do that.

我尝试调试的 Web 应用程序仅在特定 Glassfish 服务器上显示错误,因此我想远程调试 Web 应用程序。但是 Web 应用程序是在 Eclipse 中为 Java SE 开发的,我不知道该怎么做。

I have:

我有:

  1. Installed Eclipse 3.7 for Java EE
  2. Installed the Glassfish adapter
  3. Configured the server for secure login and JPDA debugging
  4. Added the server as a server in Eclipse
  1. 为 Java EE 安装了 Eclipse 3.7
  2. 安装 Glassfish 适配器
  3. 配置服务器以进行安全登录和 JPDA 调试
  4. 在 Eclipse 中添加服务器作为服务器

However, I do not see "Run on server" or "Debug on server" in the Run menu of Eclipse. If do Debug as, I can create a new Glassfish configuration but I can't select a server, so I can't configure the configuration.

但是,我在 Eclipse 的运行菜单中没有看到“在服务器上运行”或“在服务器上调试”。如果做Debug as,我可以新建一个Glassfish配置,但是我不能选择服务器,所以我不能配置配置。

采纳答案by Thorbj?rn Ravn Andersen

For Glassfish 3:

对于 Glassfish 3:

First enable debugging in the Glassfish administration console (Application Server -> JVM Settings -> General -> Debug Options) which require restarting the domain. Make a note of the port number.

首先在需要重新启动域的 Glassfish 管理控制台(应用程序服务器 -> JVM 设置 -> 常规 -> 调试选项)中启用调试。记下端口号。

Then you can attach to the Glassfish debug port like any other debug session, with a "Remote Java Application" in the debug configurations.

然后,您可以像任何其他调试会话一样连接到 Glassfish 调试端口,在调试配置中使用“远程 Java 应用程序”。