Wednesday, 29 October 2008

Tomcat Installation - TROUBLES!!!

Why are somethings seem to be so trivial but sometimes become so hard to pull off specially when in a hurry. That is what exactly happened when I tried to install tomcat in to my new Ubuntu (hardy) box. Here's what happened.

After extracting tomcat to the installation folder and making sure necessary JAVA_HOME & JDK_HOME variables are there in .bashrc I tried to start the server with ./

Output- Permission denied.
Reaction - Hmm. Should try a sudo sh

Output- Cannot find
Reaction - What! 'ls' shows file is there. What about ls -al

Discovery !!!- No execute permissions for file
Reaction- chmod +x Again tried ./

Output- Cannot find
Reaction - ok. should try chmod +x *.sh. Again ./

Output- The BASEDIR environment variable is not defined correctly
This environment variable is needed to run this program.
Reaction-What the heck!@#@#. Only help now is google.

Little bit of googling brought my attention to the CATALINA_HOME variable. So
I set it to tomcat_installtion_folder/bin in .bashrc. When tried ./ it gave this.

Output- Cannot find /home/chamith/Installations/apache-tomcat-6.0.18/bin/bin/
This file is needed to run this program
Reaction- What now????

Again little bit of googling brought my attention to the following part in the source of

if [ -r "$CATALINA_HOME"/bin/ ]; then



echo "Cannot find $CATALINA_HOME/bin/"

echo "This file is needed to run this program"

exit 1


Got the culprit. CATALINA_HOME set wrong. Should not include bin in the path of CATALINA_HOME. Should have noticed in the previous shell output.
Hope this would work.

Yep. It worked. At last............
What a relief.

P.S.: I was on the notion that CATALINA_HOME was not essential to include since the script sets it in the runtime. Anyway now the tomcat works even when I remove the CATALINA_HOME entry from the .bashrc.