Java Eclipse 中的 JBoss 调试

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

JBoss debugging in Eclipse

javaeclipsedebuggingjboss

提问by Etam

How do you configure JBoss to debug an application in Eclipse?

您如何配置 JBoss 以在 Eclipse 中调试应用程序?

采纳答案by VonC

You mean remote debug JBossfrom Eclipse ?

您的意思是从 Eclipse远程调试 JBoss吗?

From Configuring Eclipse for Remote Debugging:

配置 Eclipse 进行远程调试

Set the JAVA_OPTS variable as follows:

设置 JAVA_OPTS 变量如下:

set JAVA_OPTS= -Xdebug -Xnoagent 
   -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%

or:

或者:

JAVA_OPTS="-Xdebug -Xnoagent 
  -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n $JAVA_OPTS"

In the Debug frame, select the Remote Java Application node.

在 Debug 框架中,选择 Remote Java Application 节点。

In the Connection Properties, specify localhostas the Host and specify the Port as the port that was specified in the run batch script of the JBoss server, 8787.

在 Connection Properties 中,指定localhost为 Host 并将 Port 指定为在 JBoss 服务器的运行批处理脚本中指定的端口8787

JBoss Debug

JBoss 调试

回答by Fabian Steeg

If you set up a JBoss server using the Eclipse WebTools, you can simply start the server in debug mode (debug button in the servers view). This will allow you to set breakpoints in the application that is running inside the JBoss.

如果您使用 Eclipse WebTools 设置 JBoss 服务器,您只需在调试模式下启动服务器(服务器视图中的调试按钮)。这将允许您在 JBoss 内运行的应用程序中设置断点。

回答by xdhmoore

VonC mentioned in his answer how to remote debug from Eclipse.

VonC 在他的回答中提到了如何从 Eclipse 进行远程调试。

I would like to add that the JAVA_OPTSsettings are already in run.conf.bat. You just have to uncomment them:

我想补充一点,JAVA_OPTS设置已经在run.conf.bat. 你只需要取消注释它们:

in JBOSS_HOME\bin\run.conf.baton Windows:

JBOSS_HOME\bin\run.conf.batWindows 中:

rem # Sample JPDA settings for remote socket debugging
set "JAVA_OPTS=%JAVA_OPTS% -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"

The Linux version is similar and is located at JBOSS_HOME/bin/run.conf

Linux 版本类似,位于 JBOSS_HOME/bin/run.conf

回答by Ankit

Here, if you want to directly debug the server then you can use:

在这里,如果你想直接调试服务器,那么你可以使用:

1.)Windows->

1.)视窗->

2.)Show View-> Server: Right click on server then run In debug mode.

2.)显示视图-> 服务器:右键单击服务器,然后在调试模式下运行。

回答by Ankit

You need to define a Remote Java Application in the Eclipse debug configurations:

您需要在 Eclipse 调试配置中定义一个远程 Java 应用程序:

Open the debug configurations (select project, then open from menu run/debug configurations) Select Remote Java Application in the left tree and press "New" button On the right panel select your web app project and enter 8787 in the port field. Here is a link to a detailed description of this process.

打开调试配置(选择项目,然后从菜单运行/调试配置打开)在左侧树中选择远程 Java 应用程序,然后按“新建”按钮在右侧面板上选择您的 Web 应用程序项目并在端口字段中输入 8787。这是此过程的详细说明的链接。

When you start the remote debug configuration Eclipse will attach to the JBoss process. If successful the debug view will show the JBoss threads. There is also a disconnect icon in the toolbar/menu to stop remote debugging.

当您启动远程调试配置时,Eclipse 将附加到 JBoss 进程。如果成功,调试视图将显示 JBoss 线程。工具栏/菜单中还有一个断开连接图标,用于停止远程调试。

回答by CheshellCat

What @VonC says is correct, but you can put the commands to set debug directly into VMarguments on jBossLaunch.

@VonC 所说的是正确的,但是您可以将设置调试的命令直接放入Launch 上的VM参数中jBoss

To do that, open jBossserver inside Eclipse, go to Open launch configuration and put this in VMarguments textbox: vm args

为此,请在jBoss内部打开服务器Eclipse,转到打开启动配置并将其放入VM参数中textboxvm args