tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: How to call an external class from a webapp (i.e. - implement a plugin)
Date Wed, 07 Jul 2010 19:36:56 GMT
Hash: SHA1


On 7/6/2010 10:51 AM, Goren Il wrote:
>  There are 2 issues (not in order of priority):
> 1. The steps are not straight forward, and may cause the system to stop
> working (the customer should change the WAR suffix to "zip", open it,
> add the files and rename it back)

There isn't really a reason why the above shouldn't work.

> 2. When we provide a new version, we will replace the WAR and all the
> changes are gone.

Fair enough, but the customer can re-install their plug-ins.

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.

You'll either have to chain that ClassLoader into the standard webapp
ClassLoader provided by Tomcat for transparent class-loading by your
webapp, or write a wrapper for plug-in loading and execution by
explicitly managing and invoking that ClassLoader as necessary.

You should seriously consider how to implement security mechanisms when
loading classes that you do not provide yourself.

> I would like my webapp to call an external class, which will be
> provided (as a name) in an XML file at run time.

How does your webapp load this XML file if it isn't packaged in the WAR

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message