uCosminexus Application Server, Application Development Guide

[Contents][Glossary][Index][Back][Next]

6.10 Debugging a J2EE server started with a Server management command

You can use Eclipse to debug J2EE applications on a J2EE server started in Debug mode with a server management command.

This section describes the procedure from using the server management command to start the J2EE server in Debug mode s through debugging with Eclipse.

Organization of this section
(1) Starting a J2EE server in debug mode
(2) Debug settings for the project
(3) Executing debug

(1) Starting a J2EE server in debug mode

Use a server management command to start the J2EE server in Debug mode.

  1. Code the following contents in the Developer-installation-directory\CC\server\usrconf\ejb\J2EE-server-name-to-be-debugged\usrconf.cfg file:
    add.jvm.arg=-agentlib:jdwp=transport=dt_socket,server=y,address=debug-port-number,suspend=n
    When using an environment set up with Development Environment Instant Setup, the debug/ port number is set as 3999.
  2. Use the server management command to start the J2EE server.
    Execute the following server management command to start the J2EE server:
    cjstartsv [J2EE-server-name-for-debug#]

    #
    When using an environment set up with Development Environment Instant Setup, secify cmx_InstantWebSystem_unit1_J2EE_01 for J2EE-server-name-for-debug.

For details on the cjstartsv command, see cjstartsv (Starting J2EE servers) in the manual uCosminexus Application Server Command Reference Guide.

(2) Debug settings for the project

Create the start configuration required for debugging.

  1. In the Project Explorer view, choose the project to be debugged, and then from the Eclipse menu bar, choose Debug As - Debug Configuration.
    The Debug Configurations dialog box appears.

    [Figure]

  2. From the tree displayed in the left pane, choose Remote Java Application, and then click [Figure] (New launch configuration) in the toolbar.
    The page for creating the start configuration will appear in the left pane.
  3. Choose the Connect tab, and then specify the following contents:

    [Figure]

    Items Specified values
    Name Specify any optional name.
    Project Specify the name of the project to be debugged.#
    Connection Type Choose Standard (Socket Attach).
    Connection Properties Host Specify the host name of the J2EE server to be connected.
    When using an environment set up with Development Environment Instant Setup, specify localhost.
    Port Specify the debug port number specified in the usrconf.cfg file.
    When using an environment set up with Development Environment Instant Setup, specify the port number for the debug connection specified during set up or when changing the settings.
    When standard setup of Development Environment Instant Setup is executed, specify 3999.

    #
    When debugging an enterprise application project, set the project as blank, and then in Source tab - Source Lookup Path add the source to be used.

  4. Click the Close button.
    When a dialog box Do you want to save the changes? appears, click the Yes button. The Debug Configurations dialog box will close, and the start configuration for debugging will be created.

(3) Executing debug

Use Eclipse to execute debugging.

To execute debugging:

  1. In the Project Explorer view, open the Java source file of the project to be debugged, and set up a breakpoint.
  2. From the Eclipse menu bar, choose Run - Debug Configuration.
    The Debug Configurations dialog box appears.

    [Figure]

  3. Choose the created start configuration, and then click the Debug button.
    Debug will start. When the J2EE application is executed and the breakpoint is reached, the Debug perspective will appear. In Debug perspective - Debug view, the start configuration of the Externally Start Server will appear.
    Note
    After performing debug from the Debug Configurations dialog box, the debug operation can be started again by choosing the start configuration from the drop down menu of [Figure] (Debug) in the Eclipse menu bar.
  4. Once debugging is complete in the toolbar of the Debug view, click [Figure] (Disconnect).
    Debugging will end.