Catherine Jung wrote:
>
> Hi,
>
> I think that jars had to be put in resin/lib to be picked up
> properly - you could try that for the JUnit and cactus jars... or any other
> jars you won't want reloaded on change.
>
I'm using cactus wioth Resin, and yes we've had "classpath fun".
Resin looks in $RESIN_HOME/lib and in WEB-INF/lib for any jars to add to
the server classpath. So you can either put the cactus and junit jars in
your resin install - that way they are availble to any project that uses
Resin, or put individual versions of the junit and cactus jars in you
project's WEB-INF/lib directory.
We use the latter, putting the jars into the project lib - it means you
are then explicitly stating what versions of jar files your project is
dependent on, something your support department will be eternally
grateful for in 6 months to a years time (or you as support of course
:)...
I also try and run a machine with a totally "clean" CLASSPATH, so that I
have to set things explicitly before use, to try and avoid the "now
where did I put that file on the machine" side effects, IIRC I only have
tools.jar in the CLASSPATH.
This is ok for running resin, as if you have installed and put all your
jars in the two lib directories, then Resin is perfectly happy.
However, it becomes a PITA if you need to run code outside of the
server. I solve that with a number of different shell scripts to setup a
classpath before running say junit, or javac, or ant.
so for unit testing I have a script like so to pick up the jars:
#!/bin/bash
unset CLASSPATH
PROJECT_HOME=/home/jariw/projects/myproject
WEBINF=$PROJECT_HOME/web/webroot/WEB-INF
CLASSES=$WEBINF/classes
declare -x
CLASSPATH=$CLASSES:$JAVA_HOME/lib/tools.jar:$JUNIT_HOME/junit.jar:$RESIN_HOME/lib/jsdk22.jar:$RESIN_HOME/lib/jaxp.jar:$RESIN_HOME/lib/dom.jar:$RESIN_HOME/lib/sax.jar:$CACTUS_HOME/lib/commons-cactus.jar
WEBINFLIBS=$WEBINF/lib/*.jar
for i in ${WEBINFLIBS}
do
if [ "$i" != "${WEBINFLIBS}" ] ; then
CLASSPATH=$CLASSPATH:"$i"
fi
done
CLASSPATH=$CLASSPATH:$WEBINF/lib/classes12_01.zip
junit.sh
hope that helps... :)
If you take anything from that, I'd say my main advice would be to try
andrun your machine with a minimal CLASSPATH, so that you clearly,
explicitly set it before running anything.
right, back to the grindstone...
Jari
--
Jari Worsley
Senior Programmer
Hyperlink Interactive Ltd