views:

36

answers:

2

I need to serve several Java web applications on a single server instance, but add them dynamically to a specific URI. e.g. launch webapp to this context /user_1_app launch webapp to this context /user_2_app

I don't know what webserver to use, but I'm now investigating Jetty

Can I just drop the wars in /usr/share/jetty/webapps ?

But how can I add new ones without bouncing the server?

It have read about a way to use the scanInterval feature from ContextDeployer (which works with exploded directories) and implement it for WebAppDeployer (for wars)

Where can I get a guide to do so ?

+2  A: 

All said, you can just drop WARs in the webapps directory, and they'll just automatically deploy and come alive. IF you remove the WARs, they go away.

However, being not familiar specifically with Jetty in this regard, it is better to go through some formal deployment process. This gives your WAR access to all of the Lifecycle events. So it knows it is starting up and, perhaps as importantly, knows that it is shutting down.

But if you simply want to make them available, then copying WARs will do that and they will auto-deploy.

Will Hartung
This is exactly what I wanted to do, thanks.
MostafaEweda
+1  A: 

The answer will of course be AppServer specific, but any AppServer should be able to run multiple webapps on different contexts. Most AppServer will let you deploy apps either by copying the WAR to a specific directory, or to copy an exploded WAR, or will provide some kind of webservice.

Be aware that on most application servers (yes, even the very expensive ones) if you deploy / undeploy / redeploy applications too often, you might get memory leaks.

Guillaume