The Java EE 6 Tutorial, Volume I

Debugging Java EE Applications

This section describes how to determine what is causing an error in your application deployment or execution.

Using the Server Log

One way to debug applications is to look at the server log in domain-dir/logs/server.log. The log contains output from the Enterprise Server and your applications. You can log messages from any Java class in your application with System.out.println and the Java Logging APIs (documented at and from web components with the ServletContext.log method.

If you start the Enterprise Server with the --verbose flag, all logging and debugging output will appear on the terminal window or command prompt and the server log. If you start the Enterprise Server in the background, debugging information is only available in the log. You can view the server log with a text editor or with the Administration Console log viewer.

    To use the log viewer:

  1. Select the Enterprise Server node.

  2. Click the View Log Files button. The log viewer will open and display the last 40 entries.

    If you wish to display other entries:

  1. Click the Modify Search button.

  2. Specify any constraints on the entries you want to see.

  3. Click the Search button at the top of the log viewer.

Using a Debugger

The Enterprise Server supports the Java Platform Debugger Architecture (JPDA). With JPDA, you can configure the Enterprise Server to communicate debugging information using a socket.

    To debug an application using a debugger:

  1. Enable debugging in the Enterprise Server using the Administration Console:

    1. Expand the Configuration node.

    2. Select the JVM Settings node. The default debug options are set to:

      -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009

      As you can see, the default debugger socket port is 9009. You can change it to a port not in use by the Enterprise Server or another service.

    3. Select the Debug Enabled check box.

    4. Click the Save button.

  2. Stop the Enterprise Server and then restart it.