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.