You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Paul Teasdale <pt...@betweenmarkets.com> on 2001/04/28 04:13:30 UTC

Specifying a class loader to a Webapp.

Hi Everybody,

I am trying to figure out how to have servlets within a Webapp (context)
use a specified class loader under  Tomcat Version 4.0 Beta... 

Currently, the "tomcat default" classloader used within my servlet is a
URLClassLoader whose codebase is a list of jar:jndi//WEB-INF/lib/ ...!/
elements.

e.g:
Using from the servlet the following code:
 URL[] urls =
((URLClassLoader)this.getClass().getClassLoader()).getURLs();
Will get a list of urls in the following form:
jar:jndi:/WEB-INF/lib/zoo.jar!/

The problem is that URLClassLoaders getClassAnnotation() don't return
the URLs specified in my java.rmi.server.codebase...they simply return
those returned from the call to classloader.getURLs().

This is far from what I want!The only solution I currently have is to
create my own class loader "within" the servlet. 

So...is there a way to configure tomcat so that either:

* it provides me a class loader that is not an instance of a
URLClassLoader?
-or-
* It provides me with a class loader that I explicitly specify for the
context or my Webapp?

thanks,

Paul



---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
For additional commands, e-mail: general-help@jakarta.apache.org