Friday, December 05, 2008

Running the Liferay Tomcat Bundle as a Service

Liferay, when bundled with Tomcat 5.5 (maybe 6 too, I dont know) can be run as a windows service pretty easily with a few simple commands.  These instruction assume you have already succesfully run the program from the command line and clicked around inside the application some.

  1. Open a command prompt (Run "cmd")
  2. navigate to the liferay bin folder
    cd \liferay-portal-tomcat-5.5-5.1.2\bin
  3. Install the windows service:
    service.bat install
    (You should get a success message)
  4. Launch the tomcat service manager program thingy
  5. Change "Startup Type" to Automatic
  6. In the Java tab, append these options, one per line, to the very end of "Java Options":
    Make sure there are no spaces at the end of the options lines and make sure each option is on its own line!  This can waste hours of your time!  If MaxPermSize doesn't work then you almost certainly have a space messing you up or you're missing a carriage return.
  7. Go back to the general tab and start the service.  That's it!
The other option to make this work without step 6 is to use BEA or IBM's version of the JDK.  Those versions of Java do not have Permanent Generation space which is memory reserved for Classloaders that normally never gets garbage collected.  The three options under MaxPermSize are meant to garbage collect that permanent generation space, but I found that I still needed to increase the size of it anyways.  Liferay does use Hibernate for ORM, and a lot of people have said that Hibernate is the real problem.  I'm not sure, I just made it work.

1 comment:

Ildar said...

Thank you! I've got strange exceptions but that VM options really helped me!