« Back to Custom Deployments

Tomcat 6 as a Windows Service

You may need to run Liferay Tomcat bundle (for both Portal and Social Office) as Windows services. Right?

Best practices#

Best combination should be

  • 1) Window server 2008 64-bit, 64-bit JDK 1.6 and Tomcat 64-bit.
  • 2) Window server 2003 32-bit, 32-bit JDK 1.6 and Tomcat 32-bit.

Limitation for 2) - only 1024MB (JVM parameter) is available.

Current installation: Window server 2008 64-bit, 64-bit JDK 1.6 and Tomcat 32-bit. This is the reason that

a) Tomcat as a Windows service does not work; b) staring time is longer.

Solution: using 1) Window server 2008 64-bit, 64-bit JDK 1.6 and Tomcat 64-bit.

Then we should get:

a) Tomcat as a windows service, JVM can be set as 2048MB or bigger

b) Staring time should be shorter.

How to achieve it?#

The following are sample steps to achieve the goal: Window server 2008 64-bit, 64-bit JDK 1.6 and Tomcat 64-bit.

1) Install Windows Server 2008 (64-bit)

2) Install 64-bit JDK and set $JAVA_HOME

3) Install Liferay-Tomcat 6 bundle

4) Set $JAVA_HOME in $TOMCAT_AS_DIR/bin/setenv.bat

5) Rename tomcat6.exe and tomcat6w.exe at $TOMCAT_AS_DIR/bin/ to a whatsoever names.

6) Download tomcat6.exe and tomcat6w.exe from

Tomcat 6 x64

(for latest 64 bit binaries, refer to http://tomcat.apache.org/download-60.cgi)

And drop them to $TOMCAT_AS_DIR/bin/

7) Start service.bat install tomcat6;

8) Use >tomcat6w.exe ES tomcat6

9) Append these in Java Options:

-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}}}

10) set both Initial and Maximum memory pool to 2048 or bigger;

11) Click on General tab;

12) Click start;

That’s it.

Reference#

Tomcat 6 in Windows 64bit and a 64-JDK 1.6 - JVM -Xmx2048MB

0 Attachments
60876 Views
Average (2 Votes)
The average rating is 4.5 stars out of 5.
Comments
Threaded Replies Author Date
Thanks Jonas. Is there anyone willing to share... C Emerson November 19, 2009 6:43 AM
Thanks a lot Jonas for this article. Has been... Gaurav K Barot February 3, 2010 10:43 AM
Hey Jonas, What the files at... Thiago Leão Moreira May 4, 2010 8:46 AM
HI Thiago, thanks. The exe is coming from Apache. Jonas Yuan July 9, 2010 12:16 PM
Thanks Jonas, By the way, Apache has an... Christopher Lui May 17, 2010 11:41 AM
Thanks, Christopher. It is better to use Apache... Jonas Yuan July 9, 2010 12:17 PM
Hey Jonas, Is this instruction obsolete? I... Erik Wetterberg January 5, 2011 12:34 AM
These instructions were written for Liferay 5.1... Christopher Lui January 13, 2011 11:34 AM
Are there any additional considerations for... Mark Cummings January 12, 2011 12:36 PM
Hello! I followed your suggestions and still... Sonnie Hook October 26, 2011 7:32 PM

Thanks Jonas.
Is there anyone willing to share their experience with a Windows 2003 Server 64-bit OS install of Liferay as well?
Posted on 11/19/09 6:43 AM.
Thanks a lot Jonas for this article. Has been really helpful solving the service related issue !! I had problem with installing Tomcat as a service on Windows 2008 64bit-OS. The wiki has been really helpful and Jonas has helped personally to resolve the issue !! You're a legend mate !!!!
Posted on 2/3/10 10:43 AM.
Hey Jonas,

What the files at http://liferay.cignex.com/palm_tree/book/tomcat6x64 are?? Where did you get them? I'm little worried because they are pre-compiled exe files. Do you have their source code?

Thanks
Posted on 5/4/10 8:46 AM.
Thanks Jonas,

By the way, Apache has an official Tomcat 64bit binaries now on their SVN Repository.

http://svn.apache.org/repos/asf/tomcat/tc6.0.x/tags/TOMCAT_6_0_20/res­/procrun/
Posted on 5/17/10 11:41 AM.
HI Thiago, thanks. The exe is coming from Apache.
Posted on 7/9/10 12:16 PM in reply to Thiago Leão Moreira.
Thanks, Christopher. It is better to use Apache official Tomcat 64 bit binaries.
Posted on 7/9/10 12:17 PM in reply to Christopher Lui.
Hey Jonas,

Is this instruction obsolete? I have installed the Liferay-Tomcat 6 bundle. I have also (on another port) Tomcat (without Liferay) running as a service. When I try to follow your instructions I cant find Tomcat6.exe or Tomcat6w.exe anywhere in the Liferay-Tomcat 6 bundle. I also can not find service.bat.

What about adding Liferay to my existing Tomcat installation. Is there any instruction for that??
Posted on 1/5/11 12:34 AM.
Are there any additional considerations for upgrading from 5.2.3 to 6.0.x when running Tomcat as a service? All I have seen so far seems to point to doing the upgrades using the standard "batch file" method of running Tomcat. I used this article to help get the Tomcat running as a service so maybe someone reading here may have some experience with upgrading it when it is running as a service. Thanks in advance.
Posted on 1/12/11 12:36 PM.
These instructions were written for Liferay 5.1 and 5.2

Apparently, Liferay 6 bundle doesn't have these files as you've stated. You can download the 5.2 bundle to look at the service.bat.
For the tomcat.exe, please see my comment above to download Apache's official binaries.

As for installing Liferay on an existing Tomcat, there are lots of instructions.
You can find it in the Liferay Admin Guide 4th Edition:http://cdn.docs.liferay.com/portal/6.0/official/liferay-administrator-gu­ide-6.0.pdf

Or http://www.liferay.com/community/wiki/-/wiki/1071674/Installing+6.0+WAR+on+Tomca­t+6/maximized
Posted on 1/13/11 11:34 AM in reply to Erik Wetterberg.
Hello! I followed your suggestions and still tomcat6 startups with something wrong.
In stdout:
ERROR [PortalBeanLocatorUtil:42] BeanLocator is null tomcat

in catalina:
Error listenerStart

The whole package is copied from a windows 2003, which is still working good.
Posted on 10/26/11 7:32 PM.