Take Java Software Easy

Download Java: take Java Software easy!

Go to the first page of Download-Java.com
Home
Go to the first page of JavaFAQ.nu
Java FAQ site
A lot of Java Code Examples, categorized by API, package, class A lot of Java Code Examples, categorized by API, package, class
Code Examples
Java Forums Java Forums
Java Forum
Categorized Java Tips Categorized Java Tips
All Java Tips
Free Java Books  on the site
Books
Submit your news, Java Code Examples Submit your news, Java Code Examples Submit your news, Java Code Examples
Submit News, Code...
Search the site here...
Search...
 
News › How to Tomcat 5? Part 1
Java Tools and Software

How to Tomcat 5? Part 1

I had no problem with Tomcat installation and all installation packages which I tried, worked fine for me. I will not describe all installation steps, you always can find the details on it on the home site for Apache Tomcat.

It was a few years ago, when Tomcat had version 4.1.0. My first impression was that I am swimming in a swamp, so slow Tomcat was. The whole memory on my computer was consumed by Tomcat, every click on my program interface resulted in freezing the whole machine for second. The prstat (program in Solaris to supervise processes status, in Linux it is top command) indicated that CPU jumped to 100%.

After 5 years with Apache server I was completely disappointed...



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

I was not right. The problem was with settings, which were in my Tomcat installation. Having used that Apache runs perfectly right away after an installation, I was not ready for performance tuning. Honestly saying I have no clue how to do that. Especially after working with httpd.conf (Apache configuration file) it was not so 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. And soon Tomcat began to work better and better.

First problem was because of additional libraries in my web applications. I could not link them from Tomcat’s common/lib directory. I had to have them just in one place, directly in the common/lib, no linking for another place!

Second problem was that, even if Tomcat's documentation claims that "*.war files will be discovered in webapps directory and extracted automatically", they actually sometime could be there for hours and nothing happened. Sometimes it worked, sometime did not.

So, my advice to you: if you make an installation package for distribution to many people, it will be safer to extract files from war files by your installation program and do not rely on Tomcat. And you can disable this feature at all (I do not rely on it).

How to move Tomcat from one directory to another?

My answer here is for the Solaris and Linux OSs. But it 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 (this variable point to "home place" of Tomcat).

For example, on my machine default place was: /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 you need to open the file /etc/passwd and locate the line with tomcat’s user name. In my case this 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=/usr/local/tomcat
export CATALINA_HOME

to

CATALINA_HOME=/ home/httpd/alex
export CATALINA_HOME

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

It is just a beginning of my story about Tomcat. I continue my article about Tomcat tuning (mostly performance) in the second part.

 

Alexandre Patchine publishes Java Programming Tips on the JavaFAQ.nu site and offers free "1000 Java Tips" e-book on his site. You can find many free Java books, Java Code examples and Java tools on his site. If you learn the Java the JavaFAQ.nu site is the best place to start and continue with your study!

Article Source: http://EzineArticles.com/?expert=Alexandre_Patchine



Posted by jalex on Wednesday, May 31, 2006 (05:12:34) (2428 reads)

"How to Tomcat 5? Part 1" | Login/Create an Account | 0 comments
Threshold
The comments are owned by the poster. We aren't responsible for their content.

Related Links
 More about Java Tools and Software

Most read story about Java Tools and Software:
How to Tomcat 5, Part 2
Article Rating
Average Score: 4.25
Votes: 4


Please take a second and vote for this article:

Excellent
Very Good
Good
Regular
Bad

Options

 Printer Friendly Page  Printer Friendly Page

 Send to a Friend  Send to a Friend


Get Firefox!
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster
Interactive software released under GNU GPL, Code Credits, Privacy Policy