tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jon Pearson" <Jon.Pear...@sixnet.com>
Subject Classloaders
Date Tue, 26 May 2009 16:57:28 GMT
I'm having some trouble getting classes loaded by a new classloader to
be able to see classes which should have been loaded automatically from
WEB-INF/lib. All of the documentation that I've seen so far (FAQs,
mailing list searches, ...) describe problems that people have had using
the standard classloader that Tomcat provides, but I have yet to see one
dealing with dynamically loading classes from a new classloader defined
within a webapp.

More specifically, here is my problem:

I am developing an application suite involving a database backend which
feeds and is updated by server processes and a Web UI. To support
multiple databases, database modules (JAR files) can simply be dropped
in and loaded by each application dynamically.

The problem is that when the Web UI loads the database module, that
module is unable to actually load the JDBC driver
(org.postgresql.Driver) which is packaged in
WEB-INF/lib/postgresql-8.3-604.jdbc4.jar (I've checked the case of the
path components).

This is definitely related to classloaders; I tried placing the database
module directly into my WAR file under
WEB-INF/classes/package/name/PostgreSQLDatabale.class and it worked. But
if I do that, I lose the modularity and easy-upgrading that I achieved
by going with the dynamic loading of classes from JARs.

I'm using java.net.URLClassLoader with the parent classloader set to the
classloader that loaded my application classes, so it should
theoretically be the same classloader used to load the
postgresql-8.3-604.jdbc4.jar file.

Has anyone else encountered a problem like this? Any suggestions on what
else I should try? Thanks in advance!

Jonathan P. Pearson - Software Engineer
-------------------------------------------------- 
SIXNET - Solutions for Your Industrial Networking Challenges
331 Ushers Road, Ballston Lake, NY 12019
Tel: 1.518.877.5173, Fax: 1.518.877.8346
www.sixnet.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message