HomeDocumentation > User's guide > Sample Applications > app-per-port - Running multiple web apps on different ports

Running web apps on different ports

There are several situations in which you may need to expose different web apps on different ports on the same server, for instance you might want an admin or monitoring application to be on a different port than production apps. This sample demonstrates how to deploy additional Tomcat connectors and control which apps are exposed on which ports. In addition the new ports are opened only after the web apps they serve are completely deployed and in service, thus preventing any 404 errors.

TODO: provide a plan for jetty – it ought to be much simpler


The app consists of an ear containing three war modules. Two of these modules are the web apps to expose on separate ports, the third contains the gbeans setting up the tomcat connectors. The third should be listed last in appliction.xml to assure it is started after the other two.

Tomcat configuration.

In order to expose an app on a particular port in tomcat it is necessary to set up an entire tomcat server, not just the required connector. The engine and related gbeans for this are in the top level ("ear") of the geronimo plan.

Web module configuration.

The geronimo plans for the web modules include the following element to specify which tomcat web container the web module is to be deployed to.



The separate web apps can be accessed at