web-applicationsjbosscontextroot

How can I install one Web Application in two context roots in JBoss 4?


My goal is to install only one WAR file but to use test or production settings (for example to point to different databases) depending on the context root.

Internally the application then should check if the context name ends with TEST to control the configuration.

Is this possible with JBoss 4?

Edit: after rethinking the problem it looks like using a dedicated test / staging server installation of JBoss is much safer. Installing two copies of the same web application on one server would require a lot of additional logic. For example, if the web application needs to use a different database, it has to pass a test/production mode flag to the server at the start of a session. The server must not load the database data in advance but has to wait until the client tells him which database to use.


Solution

  • Deploy two identical copies of the same WAR file, one called MyWebApp.war, the other called MyWebAppTEST.war?