Hello,

I've been trying to follow the "Jasper 2 JSP How To" located at 

http://tomcat.apache.org/tomcat-5.0-doc/jasper-howto.html

to compile a sample JSP, but I'm running into the error 

BUILD FAILED
E:\workspace\progsoftware\trunk\source\jasper\build.xml:5: taskdef A class 
needed by class
org.apache.jasper.JspC cannot be found: javax/servlet/ServletException

I'm using the ant script provided in the Howto as-is. For the JSP, 
"process.jsp" I use

<html>
<head></head>
<body>
        Jasper
</body>
</html>

since this is only an educational demo. I do not think the problem is with the 
JSP since the error
occurs on line 5, which is a taskdef that does not mention the jsp.

My setup is Windows XP SP2, Tomcat 5.5.15 (I also tested with 5.5.12 with the 
same result), and
Ant 1.6.5. The Tomcat distributions I used were the Windows binaries with 
installers.

My command line, adapted from the Howto, is

ant -Dtomcat.home="C:\Program Files\Apache Software Foundation\Tomcat 5.5"
-Dwebapp.path=E:\workspace\progsoftware\trunk\source\jasper

webapp.path is the working directory, target directory, and source directory, 
since I want to keep
things as simple as possible while getting everything working correctly.

To make sure the path are set up correctly, here are some directory listings.

--------- BEGIN ------------

C:\apache-ant-1.6.5>dir "\Program Files\Apache Software Foundation\Tomcat 5.5"
 Volume in drive C has no label.
 Volume Serial Number is 44F4-7BC8

 Directory of C:\Program Files\Apache Software Foundation\Tomcat 5.5

01/31/2006  08:34 PM    <DIR>          .
01/31/2006  08:34 PM    <DIR>          ..
01/31/2006  08:34 PM    <DIR>          bin
01/31/2006  08:34 PM    <DIR>          common
01/31/2006  08:34 PM    <DIR>          conf
01/03/2006  09:13 AM            11,558 LICENSE
01/31/2006  08:34 PM    <DIR>          logs
01/31/2006  08:34 PM    <DIR>          server
01/31/2006  08:34 PM    <DIR>          shared
01/31/2006  08:34 PM    <DIR>          temp
01/03/2006  09:14 AM            21,630 tomcat.ico
01/31/2006  08:34 PM            66,726 Uninstall.exe
01/31/2006  08:34 PM    <DIR>          webapps
01/31/2006  08:34 PM    <DIR>          work
               3 File(s)         99,914 bytes
              11 Dir(s)   7,737,454,592 bytes free

C:\apache-ant-1.6.5>dir \apache-ant-1.6.5
 Volume in drive C has no label.
 Volume Serial Number is 44F4-7BC8

 Directory of C:\apache-ant-1.6.5

11/05/2005  06:49 PM    <DIR>          .
11/05/2005  06:49 PM    <DIR>          ..
11/05/2005  06:49 PM    <DIR>          bin
11/05/2005  06:49 PM    <DIR>          docs
11/05/2005  06:49 PM    <DIR>          etc
06/02/2005  03:15 PM               126 INSTALL
06/02/2005  03:15 PM            17,191 KEYS
01/31/2006  06:04 PM    <DIR>          lib
06/02/2005  03:15 PM            11,766 LICENSE
06/02/2005  03:15 PM             3,356 LICENSE.dom
06/02/2005  03:15 PM               677 LICENSE.sax
06/02/2005  03:15 PM             2,698 LICENSE.xerces
06/02/2005  03:15 PM               747 NOTICE
06/02/2005  03:15 PM             2,657 README
06/02/2005  03:15 PM               289 TODO
06/02/2005  03:15 PM            18,478 welcome.html
06/02/2005  03:15 PM           109,297 WHATSNEW
              11 File(s)        167,282 bytes
               6 Dir(s)   7,737,425,920 bytes free
               
--------- END ------------

I've tried the following so far

1) reverting to an older version of Tomcat, as mentioned above.
2) several Google searches, including "servletexception jasper2", but no dice
3) rewriting the build script, based on a forum discussion at 
http://www.experts-exchange.com/Web/Web_Languages/JSP/Q_21567260.html, although 
I embellished a
bit:

--------- BEGIN ------------

<project name="Webapp Precompilation" default="jspc" basedir="."> 

<property name="ant.lib" location="C:/apache-ant-1.6.5/lib"/>
<property name="tomcat.home" location="C:/Program Files/Apache Software 
Foundation/Tomcat 5.5"/>
<property name="jdk.tools" location="C:/Program 
Files/Java/jdk1.5.0_06/lib/tools.jar"/>
<property name="jasper.compiler" location="${ant.lib}/jasper-compiler.jar"/>
<property name="jasper.runtime" location="${ant.lib}/jasper-runtime.jar"/>
<property name="servlet.api" 
location="${tomcat.home}/common/lib/servlet-api.jar"/>

<echo message="${jasper.compiler}"/>
<echo message="${servlet.api}"/>
<echo message="${jdk.tools}"/>

<path id="classpath">
        <pathelement location="${jdk.javac.path}"/>
        <pathelement location="${jasper.compiler}"/>
        <pathelement location="${jasper.runtime}"/>
        <pathelement location="${servlet.api}"/>
</path>

<taskdef classname="org.apache.jasper.JspC" name="jasper2">
        <classpath refid="classpath" />
</taskdef>

<target name="jspc">
<classpath refid="classpath" />
<jasper2
        validateXml="false"
        uriroot="."
        webXmlFragment="./generated_web.xml"
        outputDir="." />
</target>

</project>

--------- END ------------

Olinga K. Abbott



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to