Debugging an EJB Module

You can debug EJB modules:

To debug an EJB module on a local machine:

  1. Be sure you have added a local server instance and set it as the default instance.
  2. Select the EJB module.
  3. Deploy the EJB module.

    To start the debugger, you must select a servlet.

  4. Select Start Debugging from the Debug menu.

    Now you are able to debug any code in the server you wish.

    A KJS process is started (or restarted) in the Execution window. Also, in the Output window deployment messages appear indicating the EJB module is created and deployment is finished.

To debug an EJB module from a remote machine:

  1. Make sure the remote server is running.

    To start the KAS server (which then starts the KJS/KXS engines) there are two ways:

    Through the NT Services: (NT only)
    1. From the Control Panel, select the Services.
    2. From the Services, select the iPlanet Application Server and select the Startup... button.
    3. Select the checkbox Allow Service to Interact with Desktop.
    4. Select OK to dismiss the Startup dialog.
    5. Select Close to close the Services dialog.

      Now when the remote server is launched, a window appears for each of the iPlanet Application Server engines.

    Through the iascontrol command: (NT or Solaris)
    1. Navigate to the directory where the iascontrol command is located. By default the directory path is <iasinstall>/ias/bin.
    2. Type the command: iascontrol start <user> <password> <hostname> <portnumber>
  2. Select the EJB module node.
  3. Right click and select Deploy EJB Module to iPlanet App Server.
  4. Set some breakpoints.
  5. Make sure the KJS server is not running.

    To stop the KJS server, the remote server must be registered first.

    To register the remote server:

    1. Launch the iPlanet Application Server Administration Tool.
    2. From the File menu, select New -> Server.
    3. Enter the following data in each field:

      Name: Enter the name of the remote machine. This is an arbitrary name you use to distinguish one server from another. For instance, you might name the servers in your enterprise according to their hostname.
      Host: Enter the hostname of the remote server. This is the DNS name of your server machine. You can also use an IP address. Port: Enter the port number for the remote administrative server. By default this is set to port 10817. Username: Enter the username you specified during installation of the remote server.
      Password: Enter the password you specified during installation of the remote server.
      To always connect to this server and display it in the Enterprise window, select the Connect to this server checkbox.

    4. Select OK to register the server.

    To stop the Remote KJS:

    1. Once the remote server is registered, the iPlanet Application Server engines for the remote machine appear in the treeview.
    2. Select the KJS process node and select the Stop Process button. This stops the KJS process.
  6. Run the KJS in debug mode:
    1. On NT, run KJS from a command prompt by typing kjs -jdb

      The system returns a mesage identifying the dt_socket address number.

    2. Take note of the transport dt_socket address number.
    3. On Solaris, the KJS debug utility is enabled during installation of the debugging configuration. If you enabled the debug configuration at installation, then the debug utility is located in <ForteInstallDir>/iASPlugin/java/kjsdebug. If you enabled the debug utility separately, the debug utility is located in <DebugSetupDir>/kjsdebug.
    4. Run the KJS utility by typing ./kjsdebug

      The kjsdebug utility uses the JDK 1.3 virtual machine for debugging. Do not use this JDK 1.3 for production purposes; it is intended for debugging purposes only.

      The system returns a message identifying the dt_socket address number.

    5. Take note of the transport dt_socket address number.

  7. From the Debug menu, select Attach to VM...

    On NT, enter the following data in each field of the Attach to VM dialog.

    Debugger Type: Accept the default setting.
    Connector: Select SocketAttach (Attaches by socket to other VMs).

    The display changes to identify a Host and Port field.

    Transport: This is a read-only field for this type of Socket Attachment.
    Host: Enter the hostname of your remote server.
    Port: Enter the transport dt_socket address you noted earlier.

  8. Select OK to dismiss the window.

    After a few minutes, a message appears in the status bar indicating that the Debugger is running.

  9. On Solaris, enter the following data in each field of the Attach to VM dialog.

    Debugger Type: Accept the default setting.
    Transport: This is a read-only field for this type of Socket Attachment.
    Host: Enter the hostname of your remote server.
    Port: Enter the transport dt_socket address you noted earlier.

  10. Select OK to dismiss the window.

    After a few minutes, a message appears in the status bar indicating that the Debugger is running.

  11. You are now ready to access your EJB through a servlet or remote method invocation (RMI).

See also
  Creating an EJB
Deploying and Executing an EJB Module


Legal Notices