You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nathan Voxland <na...@sundog.net> on 2004/09/29 18:27:28 UTC

Alternate class and lib directories

We are attempting to move our existing development environment from
Resin to Tomcat, but I am having difficulties getting our build
environment to work with Tomcat.  
 
We have many project going on a the same time, most consisting of
multiple CVS modules set up where the main module depends on a
sub-module which depends on a sub-module etc.  For example:
 
moduleRoot/src/java
moduleRoot/src/java-test
moduleRoot/src/root/web    <-- document root
moduleRoot/build               <-- where classes are compiled to for
this module
moduleRoot/build-test
moduleRoot/lib                   <-- where all the required .jar files
go
 
subModuleRoot/src/java
subModuleRoot/src/java-test
subModuleRoot/src/build    <-- where classes are compiled to for this
module
subModuleRoot/src/build-test
 
We have our IDE's set to compile to the build directory and our ant
tasks that do things like JDO enhancing and our automated build system
work with this directory structure.
 
My problem is that Tomcat expects classes to be in WEB-INF/classes and
jars in WEB-INF/lib, not where we have them.  Resin gives you the
ability to configure your class loader like this:
 
        <class-loader>
            <simple-loader path="/cvs/moduleRoot/build"/>
            <simple-loader path="/cvs/subModuleRoot/build""/>
            <library-loader path="/cvs/moduleRoot/lib""/>
        </class-loader>
 
but I can't find anything similar in Tomcat.
 
I have been trying to overload and/or re-implement WebappLoader and
WebappClassLoader but have been having no luck.  I know tomcat is
running my Loaders because the debug info I add gets printed out, but I
continue to get ClassNotFoundExceptions when on the filters and context
listeners I have set up in my web.xml.  
 
I've mainly been focusing on trying to call addRepository in
WebappClassLoader passing in moduleRoot/build, subModuleRoot/build, and
moduleRoot/lib, but that doesn't seem to be helping.  I also tried
completely re-implementing WebappLoader starting with the original code,
but I haven't been able to get that to work yet, plus I don't like
having to duplicate so much code when I feel I should be just extending
existing classes.
 
Can anyone give me a direction to look, or point me to some
configuration info I have missed?
 
Thanks,
Nathan