Question

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

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top