tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joe user <paleha...@yahoo.com>
Subject RE: Using a custom class loader to load webapp classes
Date Tue, 01 Jul 2003 22:03:28 GMT
Thanks for the info on this.  I will give it a try and
let the list know how it went.  I looked at the
WebappClassLoader.java file and it is fairly
complicated (2000 lines of code).  It looks like the
WebappLoader can _only_ use loaders which are a
subclass of WebappClassLoader, not more general
subclasses of ClassLoader.  My options are to replace
WebappLoader itself with something else or to subclass
WebappClassLoader.  Right now it looks like it is
easier to subclass WebappClassLoader.  I certainly can
write a subclass of WebappClassLoader but it is fairly
complicated and it's not clearly documented where I
should hook into that to do what.  I can always "use
the source, Luke" but any suggestions would be
appreciated.

Thanks!

--- "Cox, Charlie" <ccox@cincom.com> wrote:
> last I recall per this list was that this had some
> problems. I don't
> remember when that was, so check the archives and
> bugzilla for 'loader'
> 
> Charlie
> 
> > -----Original Message-----
> > From: Bill Barker [mailto:wbarker@wilshire.com]
> > Sent: Tuesday, July 01, 2003 2:04 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: Re: Using a custom class loader to load
> webapp classes
> > 
> > 
> > It is supposed to be supported by something like:
> >   <Context .....>
> >      <Loader
> className="com.myfirm.mypackage.MyLoader" ... />
> >   </Context>
> > 
> > Never actually tried it myself, however.
> > 
> > "joe user" <palehaole@yahoo.com> wrote in message
> >
>
news:20030701010007.25938.qmail@web20421.mail.yahoo.com...
> > > Hello Tomcatters,
> > >
> > > I have an unusual question.  I have a webapp
> which
> > > needs to load its classes from a source other
> than a
> > > regular .jar file or a .class file.  It needs to
> get
> > > them out of some other storage system, such as a
> > > database.  Don't ask me why I need to do this
> strange
> > > thing; I have my reasons for it.
> > >
> > > I have written a subclass of ClassLoader which
> does
> > > this.  The question is, how do I get this to
> work with
> > > Tomcat?  I was looking at the Tomcat source, and
> it
> > > looks like all Webapp classes are loaded by
> > > org.apache.catalina.loader.WebappClassLoader,
> which is
> > > a subclass of URLClassLoader.  I can easily
> write a
> > > subclass of WebappClassLoader which does what I
> need
> > > it to do.  The question is, how do I get Tomcat
> to use
> > > my new subclass instead of the default
> > > WebappClassLoader itself?
> > >
> > > I looked in
> org.apache.catalina.loader.WebappLoader,
> > > and see that it picks the webapp class loader by
> name,
> > > and it has a method like this:
> > >
> > >     public void setLoaderClass(String
> loaderClass) {
> > >         this.loaderClass = loaderClass;
> > >     }
> > >
> > > Is there somewhere in the Tomcat config files
> where I
> > > could set a string which gets passed to this
> method?
> > > Also, if I do make my own subclass of
> > > WebappClassLoader (call it
> SecureWebappClassLoader),
> > > where should that class be put into the Tomcat
> > > directory structure so that it can get loaded?
> > >
> > > Thanks for any advice on this unusual question.
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > SBC Yahoo! DSL - Now only $29.95 per month!
> > > http://sbc.yahoo.com
> > 
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> > 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

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


Mime
View raw message