You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Herrmann, Michael" <mi...@sap.com> on 2001/07/27 17:06:52 UTC

How to integrate own ClassLoader

Hallo,

Has anyone a hint if it is possible to replace the ClassLoader
which Tomcat uses to load servlets. 

Do to so I also can give Tomcat a ClassLoader which is a
child loader of the one it used for loading servlets.
But I don't know how to configure Tomcat that way.

The reason is that I have code which relies an a specific
ClassLoader and I like to execute it as a servlet.

Any hints are welcome,
Michael Herrmann



Re: How to integrate own ClassLoader

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Fri, 27 Jul 2001, Herrmann, Michael wrote:

> Hallo,
> 
> Has anyone a hint if it is possible to replace the ClassLoader
> which Tomcat uses to load servlets. 
> 
> Do to so I also can give Tomcat a ClassLoader which is a
> child loader of the one it used for loading servlets.
> But I don't know how to configure Tomcat that way.
> 

You can do so by modifying Tomcat sources, and making sure that your
custom class loader conforms to the requirements of Tomcat as well as your
own app.  But this is *definitely* not for the faint of heart.  It
requires very intimate knowledge of how class loaders work, and how Tomcat
uses them.

> The reason is that I have code which relies an a specific
> ClassLoader and I like to execute it as a servlet.
> 

You'd probably be better served running your code in a separate JVM (with
its own classloader), and setting up access to it (from your servlets) via
RMI or CORBA.

> Any hints are welcome,
> Michael Herrmann
> 
> 
> 

Craig McClanahan