Hi all, I am having a problem with some precompiled JSP files on Tomcat 
5.5 (problem not observed on 6.0). Below is the description:

Target environment:
OS: Linux CentOS 4.5
Tomcat: 5.5.26
JDK: 1.5.0_08 & 1.6.0_10

The error:
exception 
javax.servlet.ServletException: Servlet.init() for servlet 
org.apache.jsp.test_jsp threw exception
 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
...

root cause 
java.lang.NoSuchMethodError: 
javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
                 org.apache.jsp.test_jsp._jspInit(Unknown Source)
 org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:80)
...


The JSP:
test.jsp:
<%-- 
    Document   : test
    Created on : 18-Mar-2008, 2:27:07 PM
    Author     : haiv
--%>

<[EMAIL PROTECTED] contentType="text/html" pageEncoding="UTF-8"%-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd";>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <h2>Hello World!</h2>
    </body>
</html>

The Ant target for precompiling the JSP:

   <target depends="compile" description="Compile JSP pages." 
name="-pre-dist">
                <property environment="env"/>
                <taskdef classname="org.apache.jasper.JspC" name="jasper2" 
> 
                        <classpath id="jspc.classpath"> 
                                <pathelement 
location="${java.home}/../lib/tools.jar"/> 
                                <fileset dir="${env.CATALINA_HOME}/bin"> 
                                        <include name="*.jar"/> 
                                </fileset> 
                                <fileset 
dir="${env.CATALINA_HOME}/server/lib"> 
                                        <include name="*.jar"/> 
                                </fileset> 
                                <fileset 
dir="${env.CATALINA_HOME}/common/lib"> 
                                        <include name="*.jar"/> 
                                </fileset> 
                        </classpath> 
                </taskdef> 
                <jasper2 verbose="1" validateXml="false" 
uriroot="${basedir}/${build.web.dir}" 
webXmlFragment="${basedir}/${build.web.dir}/WEB-INF/generated_web.xml" 
outputDir="${basedir}/${build.web.dir}/WEB-INF/src" />
        <property name="platform.home" 
value="platforms.${platform.active}.home"/>
        <mkdir dir="${build.generated.dir}/src"/>
        <javac target="1.5" executable="${platform.home}/bin/javac" 
classpath="${j2ee.platform.classpath}:${build.classes.dir}:${jspcompilation.classpath}"
 
destdir="${basedir}/${build.web.dir}/WEB-INF/classes" 
srcdir="${build.generated.dir}/src"/>
    </target>


Any pointer would be greatly appreciated,

Hai Vu

Reply via email to