0

I would like to run 2 tomcat instances on the same Windows.

So I took the following steps:

  1. Downloaded tomcat to folder tomcat1
  2. Created a new folder: tomcat2
  3. Copied conf folder from tomcat1 to tomcat2
  4. Created empty folders: logs, temp,work
  5. Created a folder bin and inside I put 2 commands:

startup.bat

set CATALINA_BASE=C:\Programs\apache2
set CATALINA_HOME=C:\Programs\apache1
C:\Programs\apache1\bin\startup.bat

shutdown.bat

set CATALINA_BASE=C:\Programs\apache2
set CATALINA_HOME=C:\Programs\apache1
C:\Programs\apache1\bin\shutdown.bat 

I also changed the following in server.xml of apache2 to be:

<Server port="8006" shutdown="SHUTDOWN">
<Connector port="8081" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8444" />
<Connector port="8010" protocol="AJP/1.3" redirectPort="8444" />

While in apache1 it is:

<Server port="8005" shutdown="SHUTDOWN">
 <Connector port="8080" protocol="HTTP/1.1" 
               connectionTimeout="20000" 
               redirectPort="8443" />
 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

When I run startup.bat from apache1, although in its server.xml it is configured to be port 8080, it occupies port 8081. This way when I want to run startup.bat from apache2 - the port is busy! Either way if I first try apache2 and then apache1 I can't run both.

What is wrong?

I am using windows 7 with tomcat 7

Dejell
  • 13,947
  • 40
  • 146
  • 229

2 Answers2

1

The default CATALINA_HOME is set in catalina.bat and it is relative to the location of the bin subdirectory.

So you can unzip a tomcat binary in c:\tomcat1 and another in c:\tomcat2, and each will automatically have its own CATALINA_HOME.

As for the scenario you describe with a shared CATALINA_HOME, I see nothing that would prevent it from running ok. I would double and triple check that your startup.bat is calling the right instance, and each server.xml has the right ports configured.

A5C1D2H2I1M1N2O1R2T1
  • 190,393
  • 28
  • 405
  • 485
Adi Dembak
  • 2,433
  • 2
  • 18
  • 26
0

Recommended solution: Choose another port for your second tomcat instance to something other than 8081.
Alternate solution: Change the port the McAfee FrameworkService.exe uses. here is a thread discussing options

I just ran into a similar issue when trying to run 2 tomcat instances on ports 8080 and 8081. Use netstat -aon as recommended here to see a list of open connections and associated process ids. Tracing this id, 1988 in my case, back to the process with tasklist /FI "PID eq 1988" showed that the McAfee FrameworkService.exe process was using 8081.

Community
  • 1
  • 1
mike
  • 36
  • 2