André Warnier wrote: > Ken Bowen wrote: >> I think http://en.wikipedia.org/wiki/Java_Classloader was intended >> -- a reasonable starting point, with further references. >> > Thanks all. That was a good starting point. > Still not wanting to delve too deep into internals, but having read this: > http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html > and this: > http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html > and quoting from a previous post on this list : > "The servlet spec states that jars are to be placed in WEB-INF/lib, so > that's what Tomcat implements; if the developer wants something beyond > that, a custom classloader is what's needed." > > Now, if I wanted to do as suggested, so as to give "my webapp" a > classloader that will first look in some directory of my choice, prior > to looking into all the normal places, how would I, generally > speaking, go about it ? > > I would (I guess) first attempt to locate the basic webapp classloader > class source of what Tomcat uses as a generic webapp classloader; then > I would either extend it, or make my own parallel version and compile > it into a .class file. > Then where would I put this .class file so that Tomcat notices and > uses my classloader for my webapp, rather than using its own ? > Putting my classloader class in the WEB-INF/classes of my webapp > sounds a bit like a circular argument, no ? > On the other hand, putting it in some area of the Tomcat common lib > would make it be picked for all webapps, which is not what I want > either. So how does that part work ? (very generically, I am not > really going to write my own classloader yet). > > >
This has been discussed on the list before, but not in a while... Taking a quick look at Google w/ the phrase "tomcat custom classloader", I found http://www.nabble.com/Adding-custom-class-loader-to-webapp---td20555683.html which at least offers hints on how to do it w/ tomcat 6. I'm sure there are other search results in that list which offer more help. --David --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org