Running Liferay 6 Tomcat 6 as windows service


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

  1. set JAVA_HOME variable
  2. Copy the folder JAVA_HOME/jre/bin/server, rename the new copy of the folder as jre/bin/client.
  3. So you  JAVA_HOME/jre/bin will have 2 folder of same file
    1. JAVA_HOME/jre/bin/server
    2. JAVA_HOME/jre/bin/client

2)Download tomcat 64 bit installables.

  1. 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/
  2. 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
  3. Unzip the above archive
  4. go to apache-tomcat-$VERSION\bin
  5. copy tomcat6.exe, tomcat6w.exe, service.bat from above in to LIFRAY_HOME\tomcat\bin
  6. 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.

About these ads

8 thoughts on “Running Liferay 6 Tomcat 6 as windows service

  1. 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
    —————————

  2. 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

  3. 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….

      • 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)

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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