Sonntag, 23. September 2012

IntelliJ IDEA 11 - Setup multiple instances of Tomcat on Windows as service



Preparation

In this short tutorial i suppose you have already installed a tomcat server on your local machine. Otherwise download and install TomCat 7 here: http://tomcat.apache.org/

Part I: Install a new instance of TomCat


Steps

1. Assuming you have installed TomCat to C:\TomCat 7.0\, then copy the complete folder to C:\TomCat 7.0-2\ for example.


2. Navigate to C:\TomCat 7.0-2\bin\ and edit the server.xml file.

3. Change all ports (Shutdown-Port, Connector-Port, Redirect-Port and AJP Connector) in the server.xml configuration file. I except you know what a port is, so use free ones.

4. In the final setp we'll register tomcat7 as windows service. I prepared a short batch file to shorten the process... create a batch file within C:\TomCat 7.0-2\ and execute it via cmd.exe. But be aware, this will only work, if you start the command line with administrator privileges!

"C:\Tomcat 7.0-2\bin\tomcat7.exe" //IS//Tomcat6 --DisplayName="Apache Tomcat 7.0-Instance 2" --Install="C:\Tomcat 7.0-2\bin\tomcat7.exe" --Jvm=auto --StartMode=jvm --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop


You are done!

Part II: Configure IntelliJ


In the second part we ll tell IntelliJ to use the new TomCat instance.

Steps

1. Click "Edit run/debug configuration"

2. Add a new TomCat -> Local configuration.

3. Important: On the first page of the configuration settings you ll find a combo called "Application Server". Click "Configure.." and add the new TomCat instance by giving the new home directory.

4. Then change the URL and ports configuration.

5. You are done.


Now you can use two different TomCat instances within IntelliJ. Makes debugging f.e. serveral web services totally easy;)





Keine Kommentare:

Kommentar veröffentlichen