It is a very common scenario wherein, when you deploy liferay on Windows environment , you need to run tomcat as windows service. In this blog, i will list the steps to run tomcat as windows service.
Environment:
- Windows Server 2008 RC2 – 64 Bit
- Liferay 6EE SP2 – tomcat 6.0.32
- Sun JDK 64 bit
- LIFERAY_HOME is reffered as location where liferay bundle in unzipped.
Steps:
1) Setting up JAVA
- set JAVA_HOME variable
- Copy the folder JAVA_HOME/jre/bin/server, rename the new copy of the folder as jre/bin/client.
- So you JAVA_HOME/jre/bin will have 2 folder of same file
- JAVA_HOME/jre/bin/server
- JAVA_HOME/jre/bin/client
2)Download tomcat 64 bit installables.
- You can get the desired version of Apache Tomcat 32 bit/64 bit from Apache tomcat archive site http://archive.apache.org/dist/tomcat/tomcat-6/
- In my case i am doing for Liferay 6EE SP2 which comes with tomcat 6.0.32 so I downloaded following version of 64 bit tomcat.
http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32-windows-x64.zip - Unzip the above archive
- go to apache-tomcat-$VERSION\bin
- copy tomcat6.exe, tomcat6w.exe, service.bat from above in to LIFRAY_HOME\tomcat\bin
- Please take back up of above files in LIFRAY_HOME\tomcat\bin if they already exist.
3)Setting Up the service
a) Open the commad prompt (Make sure you have admin rights or run the command prompt as administrator)
b) In Command Prompt go to LIFERAY_HOME\tomcat\bin
c) Execute the following command
service.bat install tomcat6
This will install the tomcat6 service in windows. Please see the image below for reference
d) Now execute following commond to setup additional configuration for the services
tomcat6w.exe ES tomcat6
You will see the following window –
e) Set the following in General Tab:
- Display Name:
- Description:
- Startup Type:Automatic
f) Go to Java Tab of above window (Please see the attached image below
g)Set Initial Memory Pool, Maximum Memory Pool.
h) Append Following in Java Options text box
-XX:MaxPermSize=512m -Dfile.encoding=UTF8 -Duser.timezone=GMT -Djava.security.auth.login.config="%CATALINA_HOME%/conf/jaas.config" -Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false
4) Starting the Service
Once all the set up is done. Go to Startup menu -> Run -> type services.msc
It will open all the windows services. you can select your one and perform operations like start, stop etc
In case of any doubt, feel free to shoot me any questions through comment box.
Hi, I have 2 tomcat 6, how to install 2 tomcat6 in one computer?. Please help me!
You can run them on separate ports and install as separate services.
I am getting following error while starting the server.
I have also copied msvcr71.dll in tomcat\bin folder from jre\bin folder
—————————
Services
—————————
Windows could not start the Apache Tomcat tomcat6 on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 0.
—————————
OK
—————————
Hi Arvind, I’m able to install Liferay with Bundled Tomcat. And I found here (http://www.liferay.com/documentation/liferay-portal/6.1/user-guide/-/ai/installing-liferay-on-an-existing-application-server) the instructions to install Liferay if there’s already a Tomcat Server available and you need to refer it. There’s just a little detail I do not understand (I leave you the pleasure to understand how much is little this detail). At the end of thw procedure, it asks me to launch Tomcat by running startup.bat. My case is different. I have already a version of Tomcat installed on my server, which is configured to run as a service (and my boss tells me this couldbe a tipical situation if I’ll need to install Liferay on something like a Server Farm). So my questions is: could you suggest me what changes in the procedure suggested in the link specified above, if my tomcat server is already configured to be launches as a service? Another question: is Liferay EE necessary for this kind of work or could I keep on using Liferay CE?
Thanks for your reply and for the time you’ll spend reading this message.
Good things, Federico
Hi Arvind,
I followed the same steps for installing liferay as a service in Windows 7. But after starting service from services.msc when i hit the liferay URL I am not getting home page, and the page is going into infinite wait loop.
Please help me….
If you disable the service and run the liferay, do you still get infinite loop or not. Could you please check you liferay.logs and catalina.logs to see, if there is any error.
Here I got another simple solution that worked for me:
http://www.liferay.com/community/forums/-/message_boards/message/4679582
but with small issue, for which i didn’t found reason.
My server is not getting started when am adding both of the following lines in JAVA tab:
-XXermSize=128m
-XX:MaxPermSize=256m
Setting initial memory pool and maximum memory pool to 1024.
Only -XX:MaxPermSize=256m
and initial memory pool at 512 and maximum memory pool to 1024.
is working for me.(RAM size 3GB)
Very good article, this “tomcat6w.exe ES tomcat6” saved me a time ) Thanks!