tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brett Knights" <>
Subject RE: Question: Tomcat 3.2.1 servlet and dynamically loading JAR files
Date Mon, 04 Jun 2001 05:08:54 GMT
What are you trying to do?

If you
a) have a bunch of jar files that contain duplicate packages and
b) want to make sure only a certain version of those classes gets used

why don't you just unjar the jar files that contain the duplicates, delete the duplicating
directories, adjust the manifest file and
re-create the jar files.

If I am correct in assuming you are having problems with all the xml files that are duplicated
in saxon, xerces, crimson, Tidy, etc.
these can be cleaned up in only a few minutes (much faster than writing code).

If these are the packages you are dealing with and want some pointers on the minor associated
gotchas drop me a line directly (this
is OT).

I have a little app that will check the system class path for packages duplicated in jar files.
Let me know if you'd find that

As far as your original question it isn't too difficult to write your own classloader that
would load a properties file and then
load classes from specified packages. I'd think it would be fairly easy to subclass Tomcat's
classloaders (plural since Tomcat uses
a hierarchy of classloaders) to use your definition of classpath.


Brett Knights                             250-338-3509 work                 250-334-8309 home

> -----Original Message-----
> From:
> []
> Sent: Sunday, June 03, 2001 12:10 PM
> To:
> Subject: tomcat-user Digest 3 Jun 2001 19:09:41 -0000 Issue 1128

> I have a question about loading JAR files. It is not
> necessarily specific
> to Tomcat, i.e., it is really a generic Java question,
> but my application happens to be a servlet running under Tomcat 3.2.1.
> The question is this:
> Is there a way for a servlet running under Tomcat 3.2.1 to
> dynamically load
> specific versions of JAR files independent of what is specified in the
> CLASSPATH, so that all
> references to classes implemented in these JAR files (but possibly
> implemented in
> other JAR files contained within the CLASSPATH) are guaranteed to be
> resolved
> by classes contained within the specific, dynamically loaded
> JAR files
> and not from some other JAR files specified in the CLASSPATH.
> I am looking for a Java facility for JAR files which is analogous to
> dynamically loading C and C++ libraries on
> Sun Solaris using dlopen or on Windows using the Win32 API function
> LoadLibrary.
> Can it be done with the java.lang.ClassLoader or some other standard
> classes?
> Can someone point me to some sample code which demonstrates
> how to do this?

View raw message