This seems to be a popular question.  There have been some excellent
postings before to solve the dilemma, and some of them involved modifying
the tomcat source code.

Here are the steps for replacing tools.jar with Jikes for Tomcat 3.2.1 on
the Windows 2000 platform, without modifying the source code for Tomcat.

1. Download jikes.  It is currently available from
http://oss.software.ibm.com/developerworks/opensource/jikes/ under the IBM
Open License.
2. Add the path to the jikes.exe executable to the system PATH variable.
3. Assuming you already have the JRE (Java Runtime Environment) available,
add rt.jar to the Java classpath variable (usually found in
JAVA_HOME/jre/lib).
4. Paste the following code anywhere between the <web-app> and </web-app>
tags of the web.xml file contained in the WEB-INF directory of your web
application (not the web.xml in tomcat_home/conf).  If you don't have a
web.xml for your application, you can create one by putting the following
code between <web-app> and </web-app> tags and placing it in the WEB-INF
directory of your application context.

  <!-- Using jikes java compiler for JSP -->
    <servlet>
      <servlet-name>
          jsp
      </servlet-name>

      <servlet-class>
          org.apache.jasper.servlet.JspServlet
      </servlet-class>

      <init-param>
          <param-name>jspCompilerPlugin</param-name>

<param-value>org.apache.jasper.compiler.JikesJavaCompiler</param-value>
      </init-param>

      <load-on-startup>
          -2147483646
      </load-on-startup>
    </servlet>

  <!-- Mapping jsp pages to the jsp servlet -->
    <servlet-mapping>
      <servlet-name>
          jsp
      </servlet-name>
      <url-pattern>
          *.jsp
      </url-pattern>
    </servlet-mapping>

(It is important to clean out precompiled JSP files in Tomcat's work
directory and to search throughout the local hard drives for copies of
tools.jar and temporarily rename them before you can establish that jikes is
indeed being used to compile the JSP).

Troubleshooting:

1. It is safe to ignore the message(s) of the following format:  Ctx():
Removing duplicate servlet jsp
jsp(org.apache.jasper.servlet.JspServlet/null)
2. If you get a message like "Location: /myapp/edituser.jsp -- Internal
Servlet Error: -- org.apache.jasper.JasperException: Unable to compile class
for JSP at org.apache.jasper.compiler.Compiler.compile(Compiler.java:254)"
followed by a stack trace, most likely the system did not find "jikes.exe"
in its search path.
3. If you get a message like "Location: /myapp/edituser.jsp -- Internal
Servlet Error: -- org.apache.jasper.JasperException: Unable to compile class
for JSP -- Found 2 system errors: -- *** Error: Could not find package
"java/util" in:" followed by a list of paths, most likely the system did not
find "rt.jar" in its classpath.  "java/util" and "java/lang" are read from
"rt.jar".


Good luck!


Reply via email to