tomcat-users mailing list archives

RE: How to call an external class from a webapp (i.e. - implement a plugin)

Date

Wed, 07 Jul 2010 19:48:22 GMT

> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Subject: Re: How to call an external class from a webapp (i.e. -
> implement a plugin)
>
> Another option is to implement your own ClassLoader that
> scans a directory (such as /my/great/plugins) for JAR files
> and will load them alongside your webapp's classes.
Tomcat already has a form of this capability:
org.apache.catalina.loader.VirtualWebappLoader
If you declare this in the className attribute of a <Loader> element nested inside the
<Context> of interest, you can specify additional directories to search for class references.
It exists in all supported Tomcat levels, but is only documented in Tomcat 7:
http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html#VirtualWebappLoader_Implementation
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus
for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.