Working with Java Web Servers

If you are debugging Java web servers such as JBOSS and Apache Tomcat (both Server configuration and Windows Service configuration) in Enterprise Architect, apply these configuration requirements and procedures.

Attach to process hosting the Java Virtual Machine from Enterprise Architect

Step

Action

See also

1

Build binaries for the web server code to be debugged, with debug information.

 

 

2

Launch the server with the Virtual Machine startup option described in Server Configuration, below.

 

 

3

Import source code into the Enterprise Architect Model, or synchronize existing code.

 

 

4

Set breakpoints.

 

Breakpoint and Marker Management

5

Launch the client.

 

 

6

Attach to the process from Enterprise Architect.

 

 

Server Configuration

The configuration necessary for the web servers to interact with Enterprise Architect must address the following two essential points:

Any VM to be debugged, created or hosted by the server must have the Sparx Systems Agent command line option specified or in the VM startup option (that is:
 
-agentlib:SSJavaProfiler32 or -agentlib:SSJavaProfiler64)
 
The CLASSPATH, however it is passed to the VM, must specify the root path to the Package source files

 

The Enterprise Architect debugger uses the java.class.path  property in the VM being debugged, to locate the source file corresponding to a breakpoint occurring in a Class during execution; for example, a Class to be debugged is called:

a.b.C
 

This is located in physical directory:

C:\source\a\b

 
So, for debugging to be successful, the CLASSPATH must contain the root path:

c:\source
 

 

Analyzer Script Configuration

Using the Debug tab of the Build Script dialog, create a script for the code you have imported and:

Select the Attach to process radio button and, in the field below it, type attach
In the Use Debugger field, click on the drop-down arrow and select Java
 

All other fields are unimportant; the Directory field is normally used in the absence of any Class path property.
 

Run the Debugger

Step

Action

See also

1

Run the server and check that the server process has loaded the Sparx Systems Agent:

DLL SSJavaProfiler32.DLL or SSJavaProfiler64
 

Use Process Explorer or similar tools to prove that the server process has loaded the agent.

 

 

2

In Enterprise Architect, open the source code and set some breakpoints.

Breakpoint and Marker Management

 

3

Click on the Run Debug button in Enterprise Architect.

The Attach To Process dialog displays.

 

Debug Another Process

4

Select the server process hosting the application.

 

 

5

Click on the OK button.

A confirmation message displays in the Debug window, stating that the process has been attached.

 

 

 
The breakpoints could show a question mark. In this case the Class might not have been loaded yet by the VM. If the question mark remains even after you are sure the Class containing the breakpoint has been loaded, then either:

The binaries being executed by the server are not based on the source code
The debugger cannot reconcile the breakpoint to a source file (check Class paths), or
The JVM has not loaded the Sparx Systems agent
 

Learn more