|
 |
pro_jsp thread: Profess JSP book examples/Tomcat config
Message #1 by seasundown@a... on Wed, 9 May 2001 05:29:34
|
|
Shouldn't I be able to type "ant all" and have
examples work with Tomcat after following
instructions in Pro JSP book? Are these
instructions accurate to the letter?
All I get when type "ant" ( which should
build according to build.xml file in
the directory per pgs. 722-723) are following
errors (with first line repeated 8 times) :
--------------------------------------------------------------
'"c:\jakarta-tomcat-3.2.1\bin\lcp.bat"' is not recognized as an
internal or external command,operable program or batch file.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/tools/ant/Main
--------------------------------------------------------------
which directory for build.xml is being referenced
on pgs. 722-723? I put it in ".\webapps" ?
What follows is what I've done to "mimic
the book instruction" in the form of "diffs" 'tween working
originals & the 4 changed config files:
*************************************************
In this case there was no original build.xml in this
directory. Built completely from pgs. 722-723.
*************************************************
C:\TOMCAT_HOME\webapps>type build.xml
<project name="ProJSP" default="compile" basedir=".">
<target name-"init">
<property name="build.compiler" value="classic"/>
<property name="deploy.home" value="${tomcat.home}/webapps/projsp"/>
<property name="dist.home" value="${deploy.home}"/>
<property name="dist.src" value="${projsp.jar"/>
<property name="dist.war" value="${projsp.war"/>
<property name="javadoc.home" value="${deploy.home}/javadoc"/>
</target>
<target name="prepare" init="init">
<mkdir dir="${deploy.home}"/>
<copydir src="web" dest="${deploy.home}"/>
<mkdir dir="${deploy.home}/WEB-INF"/>
<copyfile src="etc/web.xml" dest="${deploy.home}/WEB-INF/web.xml"/>
<mkdir dir="${deploy.home}/WEB-INF/classes"/>
<mkdir dir="${deploy.home}/WEB-INF/lib"/>
<copydir src="lib" dest="${deploy.home}/WEB-INF/lib"/>
<mkdir dir="${javadoc.home}"/>
</target>
<target name="clean" init="init">
<deltree dir="${deploy.home}"/>
</target>
<target name="compile" depends="prepare" init="init">
<javac srcdir="src" distdir="${deploy.home}/WEB-INF/classes"
classpath="${deploy.home}/WEB-INF/classes"
debug="on" optimize="off deprecation="off"/>
</target>
<target name="javadoc" depends="prepare" init="init">
<!== TODO -->
<target>
<target name="all" depends="clean,prepare,compile,javadoc" init="init"/>
<target name="dist" depends="prepare,compile" init="init">
<jar jarfile="${dist.home}/${dist.src}"
basedir="." includes="**"/>
<jar jarfile="${dist.home}/${dist.war}"
basedir="${deploy.home}" includes="**"/>
<target>
</project>
**************************************************
Apparently, auto-changed as a result of: other hand edits
& executing Tomcat "startup". ( not itself hand edited)
**************************************************
C:\TOMCAT_HOME\webapps\projsp\appendixG>diff build.xml build.bak.xml
1c1,2
< <project name="ProJSP" default="dist.war" basedir=".">
---
> <project name="Professional JSP 2nd Edition, Appendix G"
> default="dist.war" basedir=".">
***************************************************
Changed according to pg. 718
***************************************************
C:\TOMCAT_HOME>diff "copy of server-bak.xml" server.xml
283a284,293
> <Context path="/projsp" docBase="webapps/projsp" debug="0"
> reloadable="true" >
> </Context>
****************************************************
Auto changed as a result of other hand edits
& running startup Tomcat "startup". ( not itself
hand edited)
***************************************************
C:\TOMCAT_HOME\conf>diff build.bak.xml build.xml
142a143,166
> <!-- ===== Build Wrox Profess JSP === -->
> <target name="prepare" init="init">
>
> <!-- Compile the J2EE integration components -->
> <mkdir dir="${deploy.home}"/>
> <copydir src="web" dest="${deploy.home}"/>
> <javac srcdir="src/j2ee"
> optimize="${optimize}"
> destdir="${tomcat.build}/classes"
>
classpath="${servlet.jar};${j2ee.home}/lib/classes;${j2ee.home}/lib/j2ee.
jar"
> debug="${debug}" />
>
> <!-- Copy the corresponding resource files -->
> <copy todir="${tomcat.build}/classes">
> <fileset dir="src/j2ee">
> <include name="**/*.properties"/>
> <include name="**/web.dtd"/>
> <include name="**/web.xml"/>
> </fileset>
> </copy>
> </target>
**************************************************
I've tried to "hop-scotch" along through
instructions and now Tomcat window does not
stay up. "tomcat" is still working but the
console window which used to stay up just
closes immediately after startup. There are several
directories under TOMCAT_HOME ( which now include the
Wrox Pro JSP examples) where these edited files
exist( eg, build.xml & web.xml).
The book does not make clear which of these
files are to be edited with the proposed edits
or even if these files are to be placed in
yet another location in this directory structure.
And if it is clear, & I did what was stated,
ant is not working to build examples.
Here are locations of build.xml:
/conf/build.xml
/doc/appdev/sample/build.xml
/webapps/build.xml
/webapps/projsp/appendixG/build.xml
/webapps/projsp/ [ch01-ch24 ] /build.xml
locations for web.xml:
/conf/web.xml
/doc/appdev/sample/etc/web.xml
/webapps/admin/WEB-INF/web.xml
/webapps/examples/WEB-INF/web.xml
/webapps/projsp/ [ch01-ch24] /etc/web.xml
/webapps/ROOT/WEB-INF/web.xml
/webapps/test/WEB-INF/web.xml
My simple plea: How do I put the config files &
Wrox files & edits where they belong by hand:
Some things which would help me:
A.) Please send changes needed to be made to a
pristene install of Tomcat ( which was working
before ruining it based on guidelines from
pgs. 718-723 in book. Provide no "choices"
in naming, alternatives, etc. Just send something
which works. I'll accept names & alternative provided.
Indicate WHICH files in WHICH directories
need changes applied & where examples
should go under $TOMCAT_HOME.
Or
B.) Send full un-snipped versions of these files
which incorporate changes & where they should
be placed such that when I try "startup" for
Tomcat, it will work again & allow book examples
( and previous default examples to work) & "ant"
will work to build wrox examples.
or
C.) Send some combination of above that will
fix Tomcat and ant to work properly with
wrox examples (& default Tomcat install examples).
or
D.)
Zip up a working directory structure of $TOMCAT_HOME
which I can unzip ( including Wrox examples )
into my $TOMCAT_HOME.
or
E.)
Zip up some working subset of the directory/file structure
of where I can unzip into place & then run "ant all" (or
whatever).
TIA!!!!
|
|
 |