Part 8: Performing Remote Debugging

  1. Follow the instructions in Part 2: Setting A Server Instance to create a remote server instance and set it as the default instance.
  2. 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>

  3. Locate or mount the HelloServlet you created in Part 4: Creating Servlets.
  4. Select the web module node where the HelloServlet file is located.
  5. Right click and select Tools -> Deploy WAR to iPlanet App Server...

    Similarly, you can select Execute in Web Server if you wish to deploy and execute the web module.

    Additionally, to debug an EJB module select Tools -> Deploy EJB module to iPlanet App Server...

  6. Double click on the HelloServlet node to open it in the Source Editor.
  7. Set some breakpoints by selecting the new breakpoint icon from the build toolbar.
  8. Make sure the Java 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 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.

  9. Run the KJS in debug mode:
    1. On NT, run KJS from a command prompt by typing kjs -jdb

      The system returns a mesage similar to the following:

    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 similar to the following:

    5. Take note of the transport dt_socket address number.

      You are now ready to debug the HelloServlet.

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

    On NT, the Attach to VM dialog appears as follows:

    Enter the following data in each field:

    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.

  11. Select OK to dismiss the window.

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

  12. On Solaris, the Attach to VM dialog appears as follows:

    Enter the following data in each field:

    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.

  13. Select OK to dismiss the window.

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

  14. Access the URL of the HelloServlet via the browser to avoid deploying.

    When you execute the servlet, the KJS engine may cache the classes. If you edit your code and wish to execute the edited code:

    1. Deploy the servlet.
    2. Stop the KJS engine.
    3. Restart the KJS in debug mode.

  15. From the Debug menu, select Continue to proceed to the next breakpoint.
  16. Proceed through each breakpoint.

    After the request code is completely executed, the browser launches and displays as follows:

See also
  Importing an iPlanet Application Builder Project


Legal Notices