I think it is a good question.
I found it also confusing. I installed tomcat few minutes ago (after a while) and I notice they are two different "webapps" places.
at /usr/share/tomcat6/webapps/default_root/ at /var/lib/tomcat6/webapps/ROOT/
The content of both are the same but none of them are symlinks.
When I started tomcat it says:
Quote:
This is the default Tomcat home page. It can be found on the local filesystem at: /var/lib/tomcat6/webapps/ROOT/index.html
Tomcat6 veterans might be pleased to learn that this system instance of Tomcat is installed with CATALINA_HOME in /usr/share/tomcat6 and CATALINA_BASE in /var/lib/tomcat6 So, based in this information, the /usr/share/... folder was kept for backward compatibility, right?
But according to what you posted libs are being read from the CATALINA_HOME instead of CATALINA_BASE.
Perhaps they still keep that default reference to prevent other systems to stop working after updating?
Good observation!
UPDATE:
I read this at: /usr/share/tomcat6/bin/catalina.sh :
Quote:
# CATALINA_HOME May point at your Catalina "build" directory.
#
# CATALINA_BASE (Optional) Base directory for resolving dynamic portions
# of a Catalina installation. If not present, resolves to
# the same directory that CATALINA_HOME points to.
When we read at: /etc/init.d/tomcat6 :
(at the beginning)
CATALINA_HOME=/usr/share/$NAME
(then...)
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
However, If you try to start TOMCAT manually (as I did long time ago) with: sudo /usr/share/tomcat6/bin/startup.sh
It displays:
Quote:
Using CATALINA_BASE: /usr/share/tomcat6
Using CATALINA_HOME: /usr/share/tomcat6
Using CATALINA_TMPDIR: /usr/share/tomcat6/temp
Using JRE_HOME: /usr
touch: cannot touch `/usr/share/tomcat6/logs/catalina.out': No such file or directory
/usr/share/tomcat6/bin/catalina.sh: 357: cannot create /usr/share/tomcat6/logs/catalina.out: Directory nonexistent
So, why here CATALINA_BASE is set to the same as CATALINA_HOME?
/usr/share/tomcat6/logs/ do not exist, but exists in /var/lib/tomcat6/logs/
I see that my logs are writing into /var/lib/... when starting Tomcat from the init.d script. So its better starting it from there.
CATALINA_HOME: Represents the root of your Tomcat installation, for example /home/tomcat/apache-tomcat-9.0. 10 or C:\Program Files\apache-tomcat-9.0. 10 . CATALINA_BASE: Represents the root of a runtime configuration of a specific Tomcat instance.
CATALINA_HOME is the folder where Apache Tomcat is installed e.g. c:\program files\Apache Tomcat or /usr/apache/tomcat . It is the folder where you unzip Tomcat in the first place (when you install from zip).
By default, CATALINA_HOME is /usr/share/tomcat6 , and CATALINA_BASE is /var/lib/tomcat6 . In either Tomcat6 or Tomcat7 installed with Apt-Get, find the declarations of CATALINA_HOME and CATALINA_BASE, in /etc/init. d/tomcat6 or tomcat7, and EXPORT them to the OS variables.
The shell scripts located in "CATALINA_HOME/bin" are the most bare-bones way of getting Tomcat up and running. The two scripts capable of starting Tomcat in this directory are named "catalina" and "startup", with extensions that vary by platform.
I'm not an expert on Tomcat but I was having this same problem and I was able to restart the server with the command:
sudo /etc/init.d/tomcat6 restart
CATALINA_HOME -- tells "org.apache.catalina.startup.Bootstrap" where to look for required /lib /bin and other -- which are dependencies to run the server . It is basically your Tomcat installation home directory.
CATALINA_BASE -- expects a certain directory structure to scan for (once started). For example /conf to find server.xml and web.xml which is specific to a web application. as long as you have got that directory structure and content, CATALINA_BASE can be any directory.
I've seen that.
The proper and cute way is to create a "setenv.sh" script into your CATALINA_HOME/bin folder(in your case "/usr/share/tomcat6/bin/setenv.sh").
The contents of your setenv.sh:
#!/bin/sh
export CATALINA_BASE=/new/catalinabase/path
So there is no need to modify catalina.sh by yourself. If setenv.sh is present in bin directory, catalina.sh will execute it automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With