tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Shaw <MS...@centricasoftware.com>
Subject RE: Design question: common/lib --> WEB-INF/lib
Date Sat, 06 Apr 2002 00:28:31 GMT
Craig, nevermind, it's because I was still casting the object using an
interface that wasn't in my common/lib.

-----Original Message-----
From: Mark Shaw [mailto:MShaw@centricasoftware.com] 
Sent: Friday, April 05, 2002 4:24 PM
To: 'Tomcat Users List'
Subject: RE: Design question: common/lib --> WEB-INF/lib


> ClassLoader webappLoader =
>   Thread.currentThread().getContextClassLoader();
> Class webappClass = webappLoader.loadClass("com.mycompany.MyClass");

> This works because the container (Tomcat in this case) always sets the
thread context class loader to the one 
> for the webapp being executed on the current request thread -- 
> therefore,
the classes in /WEB-INF/classes and 
> /WEB-INF/lib are visible via this class loader, even though the class
containing the above code is loaded
> from somewhere else.

Craig, 
I still get a ClassNotFoundException.  I've implemented a Realm that extends
RealmBase.  My code that references the webapp class is in getPassword().
I'm assuming that this is called from a request thread? What's interesting
is that loadClass() doesn't throw the exception, but then I try to call
webappClass.newInstance(), a ClassNotFoundException is thrown?

Any ideas?  Thanks.
-Mark

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message