Table of Contents | Previous | Next | Index | Bookshelf

Programmer's Guide to Servlets


Appendix E
Debugging Servlets and JSPs

This appendix gives guidelines for debugging servlets and JSPs in iPlanet Web Server 4.1.

Servlet Debugging

iPlanet Web Server 4.1 ships with the Java Runtime Environment (JRE) but not the Java Development Kit (JDK) due to licensing restrictions. However, during installation, you can select an option that tells the server to use a JDK if there is one installed elsewhere on your system.

If the server has been instructed to use a JDK, you can do remote servlet debugging. If the server is using the JRE, you need to switch it to using the JDK before you can do remote debugging. For information on instructing the server to use the JDK or the JRE, see the section "Configuring JRE/JDK Paths."

Assuming that the server is using the JDK, you can enable remote debugging by following these steps:

  1. Make sure that the server is running in single-process mode. Single-process mode is the default, but you can check in the file magnus.conf to make sure that the MaxProcs parameter is not set to a value greater than 1. If you do not see a setting for MaxProcs in magnus.conf, the default value of 1 is enabled for it. For more information about single process mode versus multi-process mode, see Chapter 7, "Configuring Server Preferences," in the iPlanet Web Server Administrator's Guide.
  2. Set the following parameters in jvm12.conf as appropriate:

    jvm.enableDebug=1
    java.compiler=NONE
  3. In addition, on some platforms, you may be required to specify the bootclasspath. For example, for Solaris platforms, if Java 1.2 is in /java, you set it as:

    jvm.option=-Xbootclasspath:/java/lib/tools.jar:/java/jre/lib/rt.jar
  4. Start the server manually and record the password for remote debugging (this is displayed on the console).
  5. Start the Java debugger:

    jdb -host your_host -password the_password
You should be able to debug your Java classes now using the jdb command.

JSP Debugging

iPlanet Web Server 4.1 uses a public domain JSP compiler developed as part of Apache Software Foundation's Jakarta project. The Jakarta project develops a servlet engine called Tomcat, which includes a JSP compiler called Jasper. The version of the JSP compiler is taken from the Tomcat 3.0 Milestone release. Subsequent versions of iPlanet Web Server will use later versions of the Jasper JSP compiler. For more information, see the following web site:

http://jakarta.apache.org/

iPlanet Web Server 4.1 uses a native servlet engine, but uses the Jasper JSP compiler for compiling a JSP page into a servlet. Jasper and iPlanet Web Server 4.1 are not tightly integrated, so you might need to edit the JVM Classpath (in the Configure JVM Attributes page of the Server Manager or in the jvm12.conf file) when deploying JSPs using Tag Libraries, beans, and so on.

For information about how to enable JSPs, see "Activating Servlets and JSP." You can debug your JSPs by following these steps:

  1. Make sure that the server is running in single-process mode. Single-process mode is the default, but you can check in the file magnus.conf to make sure that the MaxProcs parameter is not set to a value greater than 1. If you do not see a setting for MaxProcs in magnus.conf, the default value of 1 is enabled for it. For more information about single process mode versus multi-process mode, see Chapter 7, "Configuring Server Preferences," in the iPlanet Web Server Administrator's Guide.
  2. Set the following parameters in jvm12.conf as appropriate:

    java.compiler=NONE
    jvm.trace=6
    nes.jsp.enabledebug=1
Setting java.compiler=NONE includes line numbers of the Java source code in the verbose output of the log files. Setting jvm.trace=6 enables verbose output from the JSP compiler and the servlet engine. Setting nes.jsp.enabledebug=1 makes iPlanet Web Server 4.1 generate debuggable Java servlets from the JSPs.

Table of Contents | Previous | Next | Index

Last Updated: 02/25/00 16:19:14

© Copyright © 2000 Sun Microsystems, Inc. Some preexisting portions Copyright © 2000 Netscape Communications Corp. All rights reserved.