Running Multiple Instances of Tomcat/TomEE

At times, you need to run multiple Tomcat or TomEE processes. In this article, we will find out how to do that.

Well, first of all, extract the Tomcat/TomEE distribution in a different folder than where it is already installed. Next, you will need to worry about port numbers. Tomcat/TomEE listens on these ports:

  • 8005 – For shutdown command.
  • 8080 – HTTP
  • 8009 – AJP connector.

For the second server instance, we will need to change these ports.

Open con/server.xml of the second server. Search forĀ port and change the ports to unique values. For example:

<Connector port="8081" protocol="HTTP/1.1"
redirectPort="8443" />

If you have an Apache reverse proxy setup, create a virtual host for the new instance:

<VirtualHost *:80>
  DocumentRoot /etc/apache2/vhosts.d/example2
  ProxyPassReverse / http://localhost:8081/example2/
  ProxyPass / http://localhost:8081/example2/
  HostnameLookups Off
  UseCanonicalName Off

  <Directory "/etc/apache2/vhosts.d/example2">
  AllowOverride None
  Options +ExecCGI -Includes
  Order allow,deny
  Allow from all


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s