ER/Box powered by Compiere
 
Font size:      

Debugging the ER/Box Server

Lots of business logic is contained directly in the client but some other functionality is deployed as a server application, e.g. the accounting processor or the web interface. The corresponding code can be debugged from within Eclipse as a Remote Java Appliction. The instructions on this page are intended as an example for server side debugging.

Prerequisites

Step-by-Step

1. Modifiy Server Startup File

In order to allow a remote debug session to attach to the server process the startup file {COMPIERE_HOME}/jboss/bin/run.bat has to be modified.

The added line is marked red in the following listing:

Artificial line break for better readability; KEEP ON ONE LINE!

@echo off
rem -------------------------------------------------------------------------
rem JBoss Bootstrap Script for Win32
rem -------------------------------------------------------------------------

...

rem Sun JVM memory allocation pool parameters. Modify as appropriate.
set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

rem JPDA options. Uncomment and modify as appropriate to enable remote debugging.
rem set JAVA_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE ...
set JAVA_OPTS=-classic -Xdebug -Xnoagent -Djava.compiler=NONE
              -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%

rem Setup the java endorsed dirs
set JBOSS_ENDORSED_DIRS=%JBOSS_HOME%\lib\endorsed

...

:END_NO_PAUSE

2. Create a Debug/Run configuration

Click on the down arrow next to the Bug icon and choose Debug... :

Debug... menu

Select Remote Java Application and click New :

New Remote Java Application

In the following screen please fill in the fields

  • Name: {Choose debug/run configuration name, e.g. erboxSvrDebug}
  • Project: erbox
  • Host: {Host on which the application server will be running , often localhost}
  • Port: {Debug port to attach to, here 8787}

Main Java Application settings

Please click Apply to activate the settings, then click Close to leave the window.

3. Start Debugging Session

First start the application server (incl. database server) as usual with the activated debug settings (see above).

Next open the file serverApps/src/main/servlet/org/compiere/www/WLogin.java in Eclipse and set a breakpoint at the beginning of the doPost method :

Set breakpoint in doPost-method

Click on the down arrow next to the Bug icon and choose Debug... :

Select Debug... menu

In the following screen select the just created remote debug configuration and click Debug. The debug session will attach to the running application server :

Select remote debug configuration

Now open your web browser and enter the URL of your application server (not localhost but the real computer name). You will be presented with a list of options for further navigation. In the Web Application line click on Compiere Application Login :

Select remote debug configuration

Eclipse will switch to the debug perspective and code execution will stop at the previously defined breakpoint:

Select remote debug configuration