Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures


Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips


Submit News
Search the site here...
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

How to Tomcat 5? Part 1

JavaFAQ Home » Java Tools Go to all tips in Java Tools

Bookmark and Share

The writing below is about Tomcat 5.5.15 but it works well with earlier versions of 5.x Tomcat as well.

When I started to develop my first JSP program the first question was – how and where I am going to test it. Since there was no money to buy something, my decision was to look around and find free server. After looking around, I decided to try Tomcat.

I had no problem with installation and all installation packages which I tried worked for me. I will not describe it, you always can find the details on Tomcat installation process on the Tomcat download page.

It was a few years ago, when Tomcat's version was something like 4.1.x, I do not remember exactly… My first impression was that I am swimming in a swamp, so slow it was. Whole memory on the computer seems was consumed by Tomcat and every click on my program interface resulted in freezing the whole machine for second and hitting prstat (program in Solaris to supervise processes status, in Linux it is top command) to 100% (it was on Solaris machine). After more than 5 years with Apache I was completely disappointed Sad

I thought that those guys that always complain about Java are right – it is just waste of money, resources and time. This always hungry (in terms of resources) monster – Tomcat - will never fly!!!

I was not right. The problem was with settings, which were in my Tomcat’s installation. Having used that Apache runs perfectly right away after an installation, I was not ready for Tomcat’s performance tuning. Honestly saying I have no clue how to do that. Especially after working with httpd.conf (Apache configuration file) it was not such easy to get into multiple xml files where Tomcat’s configuration is spread around. Some strange things happened here and there…

First step was to make everything working, at least.

But after a while things began to work better and better.  

  1. First thing that I discovered was problem with additional libraries in my web applications I used.  I could not link them from Tomcat’s common/lib directory. I had to have them on the place, directly in common/lib, no linking!
  2. Second thing that I found that, even if documentation claims that *.war files will be discovered in webapps directory and extracted automatically, they actually sometime can be there for hours and nothing happens. Sometimes it worked, sometime did not. If you make an installation package for distribution to many people, it will be safer to extract files from war files by installation program and do not rely on Tomcat.

How to move Tomcat from one directory to another?

My answer here is for Solaris and Linux. But I assume that is very similar procedures for Windows.

Tomcat 5.x comparing to earlier versions has quite good structure and properly written configuration files. There are no files with hard coded paths or versions. Everything is read from surrounding environment and it makes Tomcat very transportable. You can easily move Tomcat from one place to another. Just update environment variable $CATALINA_HOME

For example on my machine it was default place /usr/local/tomcat. Later I moved it to /home/httpd/alex

I was running Tomcat as tomcatuser and default shell for that user was bash. To find out which shell is default in your case open file /etc/passwd and locate the line with tomcat’s user name. In my case the line looked like this:

tomcatuser:x:112:214:Tomcat process user/usr/local/tomcat /:/bin/bash

So, I opened the file .bashrc in home directory for tomcatuser and changed two lines:



CATALINA_HOME=/ home/httpd/alex

That’s all. Now Tomcat 5 can run from new place.

It is just a beginning about Tomcat. I plan to continue my article about Tomcat’s tuning (mostly performance) if I see that you are interested in continuation. Please leave your comment to the first part of article below in “comments?? link. This article is also published in Java Blog section. You can start your own blog there as well.

If you have no time to wait until second part of article, please continue your search!

Disclaimer: English is not native language for me and I appreciate if you correct my errors in a friendly way Smile

 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search

Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy