You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Maxim Veksler <ma...@gmail.com> on 2008/11/18 09:58:46 UTC

Adding custom class loader to webapp ?

Hello,

Quoting from JETTY documentation
(http://docs.codehaus.org/display/JETTY/Classloading) :


"""
Using a custom WebAppClassLoader

Finally, if none of the other alternatives already described meet your
needs, you can always provide a custom classloader for your webapp. It
is recommended, but not required, that your custom loader subclasses
org.mortbay.jetty.webapp.WebAppClassLoader. You configure the
classloader for the webapp like so:

MyCleverClassLoader myCleverClassLoader = new MyCleverClassLoader();
...

WebAppContext webapp = new WebAppContext();
...
webapp.setClassLoader(myCleverClassLoader);
"""


Can I do this with tomcat in the method:

- class ApplicationWatch implements ServletContextListener
  - public void	contextInitialized(ServletContextEvent ce) {
    ... ?

--
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?

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


Re: Adding custom class loader to webapp ?

Posted by Bill Barker <wb...@wilshire.com>.
"Maxim Veksler" <ma...@gmail.com> wrote in message 
news:b400c69a0811180058o25c0dc7cob6cd97e41b83ec83@mail.gmail.com...
> Hello,
>
> Quoting from JETTY documentation
> (http://docs.codehaus.org/display/JETTY/Classloading) :
>
>
> """
> Using a custom WebAppClassLoader
>
> Finally, if none of the other alternatives already described meet your
> needs, you can always provide a custom classloader for your webapp. It
> is recommended, but not required, that your custom loader subclasses
> org.mortbay.jetty.webapp.WebAppClassLoader. You configure the
> classloader for the webapp like so:
>
> MyCleverClassLoader myCleverClassLoader = new MyCleverClassLoader();
> ...
>
> WebAppContext webapp = new WebAppContext();
> ...
> webapp.setClassLoader(myCleverClassLoader);
> """
>
>
> Can I do this with tomcat in the method:
>
> - class ApplicationWatch implements ServletContextListener
>  - public void contextInitialized(ServletContextEvent ce) {
>    ... ?
>

Nope.  You have to do it via the Context configuration file: 
http://tomcat.apache.org/tomcat-6.0-doc/config/loader.html .  For best 
results, you may want it to subclass 
org.apache.catalina.loader.WebappClassLoader.

> --
> Cheers,
> Maxim Veksler
>
> "Free as in Freedom" - Do u GNU ?
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 




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