Tomcat is installed with CATALINA_HOME in /usr/share/tomcat6 and CATALINA_BASE in /var/lib/tomcat6

chandrasekhar picture chandrasekhar · Aug 10, 2010 · Viewed 76k times · Source

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.

Answer

Jeff Wu picture Jeff Wu · Jun 23, 2011

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