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 ./startup.sh.
Output- Permission denied.
Reaction - Hmm. Should try a sudo sh startup.sh
Output- Cannot find startup.sh
Reaction - What! 'ls' shows file is there. What about ls -al
Discovery !!!- No execute permissions for startup.sh file
Reaction- chmod +x startup.sh. Again tried ./starup.sh.
Output- Cannot find catalina.sh
Reaction - ok. should try chmod +x *.sh. Again ./startup.sh
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 ./starup.sh it gave this.
Output- Cannot find /home/chamith/Installations/apache-tomcat-6.0.18/bin/bin/setclasspath.sh
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 catalina.sh.
if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
echo "This file is needed to run this program"
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.