Tomcat 6 add webapp-specific dir for loading classes
Tomcat 6 first looks in .../WEB-INF/classes, then .../WEB-INF/lib when loading classes. I'd like to add another directory to this search path. This directory must only be used by a specific webapp. I'd like to configure this using a context XML file (I'm thinking the Loader http://tomcat.apache.org/tomcat-6.0-doc/config/loader.html component)
I've read this
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
but it doesn't seem to have an answer for me. Looking at this
http://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/loader/WebappLoader.html
It seems 开发者_StackOverflowI could call addRepository to add a new jar file or directory containing classes. But I'm not sure where or how I would call this.
These functionality can only be done by tomcat itself.You cannot decide where to load classes because of security concerns unless you modify the tomcat source code and recompile them, but that's not a wise idea.
精彩评论