Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending Java Web Applications with plugins

I have this web application that has grown to an unmanageable mess.

I want to split it into a common "framework" part (that still includes web stuff like pages and images) and several modules that add extra functionality and screens. I want this refactoring to also be useful as a plugin system for third-party extensions.

All modules need to be separate unit of deployments, ideally a war or jar file.

I tried to just make several regular war files, but Tomcat keeps (according to the servlet spec) these war files completely separate from each-other, so that they cannot share their classes, for example.

I need to plugins to be able to see the "main" classpath.

I need to main application to have some control over the plugins, such as being able to list them, and set their configuration.

I would like to maintain complete separation between the plugins themselves (unless they specify dependencies) and any other unrelated web applications that may be running on the same Tomcat.

I would like them to be rooted under the "main" application URL prefix, but that is not necessary.

I would like to use Tomcat (big architectural changes need to be coordinated with too many people), but also to hear about a clean solution in the EJB or OSGi world if there are.

like image 642
Thilo Avatar asked Oct 03 '08 23:10

Thilo


2 Answers

I have been tinkering with the idea of using OSGi to solve the same problem you are describing. In particular I am looking at using Spring Dynamic Modules.

like image 115
Brian Matthews Avatar answered Nov 11 '22 09:11

Brian Matthews


Take a look at Java Portlets - http://developers.sun.com/portalserver/reference/techart/jsr168/ - in a nutshell, a specification that allows interoperability between what are otherwise self-contained j2ee web applications

Edit I forgot to mention that Portlets are pretty much framework agnostic - so you can use Spring for the parent application, and individual developers can use whatever they want on their Portlets.

like image 3
Ian Avatar answered Nov 11 '22 09:11

Ian