How to debug JBOSS application in netbeans?

人盡茶涼 提交于 2019-11-28 01:55:56

问题


I come from a .NET background where I can easily debug a web application by adding a breakpoint and building/running the application.

I'm working on a JAVA EJB3 application. I have successfully deployed ejb project to the server, but what I'd like to do know is develop controllers and views. In order to do that I'd like to be able to run/debug the project in net beans.

I have added both JBOSS5 and JBOSS6 into the IDE, but it takes over a minute to start. Sometimes it hangs completely. I don't have this issue when I run a glassfish - it takes few seconds at the most to start up. PC spec is up to date, it's corei7 with ssd and 4gb of RAM.

Thank you


回答1:


Enable remote debugging as follows:

  1. Set JAVA_OPTS to:
-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
  1. Click Debug >> Attach Debugger
  2. Ensure the port is 8787.
  3. Click OK.

Remote debugging is enabled; set breakpoints as usual.


Or enable remote debugging as follows:

  1. Edit %JBOSS_HOME%/domain/configuration/domain.xml
  2. Find <jvm name="default">
  3. Insert the following element:
<jvm-options>
  <option value="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"/>
</jvm-options>
  1. Save the file.
  2. Restart JBoss.
  3. Click Debug >> Attach Debugger
  4. Ensure the port is 8787.
  5. Click OK.

Remote debugging is enabled; set breakpoints as usual.

The Output - Debugger Console panel should show:

Attaching to localhost:8787
User program running

Or, in domain mode, configure the server's host.xml as follows:

<server name="server-one" group="main-server-group">
    <jvm name="default">
        <jvm-options>
            <option value="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"/>
        </jvm-options>
    </jvm>
</server>


来源:https://stackoverflow.com/questions/5337787/how-to-debug-jboss-application-in-netbeans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!