Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I can't find a definitive answer to why Ubuntu would set the CATALINA_BASE environment variable, making it different from CATALINA_HOME. I found this document which suggests that not setting CATALINA_BASE would make it equivalent to CATALINA_HOME. That document also suggests that setting CATALINA_BASE would be done to make multiple instances available.

However, I don't seem to be able to find anything that explains this. Presumably, running with a single CATALINA_HOME has been good for a long time, but Ubuntu switched.

I found this question with an illuminating answer on AskUbuntu but there isn't much specifically on CATALINA_HOME vs. CATALINA_BASE. That question does allude to the "appBase" parameter, which is documented in the Tomcat6 documentation for the Host container in the configuration file.

Here's the questions: Why are these two variables separated? When should they be separated? What does this allow the administrator to do? What do you then place into each directory? When should these two variables be the same? What does ASF recommend for standard practice?

share|improve this question
add comment

2 Answers

Why are these two variables separated?

catalina.home points to the location of the common information.
catalina.base points to the directory where all the instance specific information are held.

So you have 1 home and can have more than 1 base.

When should they be separated? When should these two variables be the same?

If you have 1 tomcat you can set them to the same value but good practice would suggest you plan ahead and keep them separate: you never know if you need more than one tomcat. Ubuntu started following this way of thinking due to it being more logical: it makes it easier to run 2+ tomcats but does not disable running 1 tomcat where setting them both to the same value would require everyone to edit the base value. Makes more sense to keep them different.

What does this allow the administrator to do?

Allow for more than 1 tomcat to run at the same time where each tomcat instance can have their own apps.

What do you then place into each directory?

Home contains the binairy.
Base contains conf, logs, webapps, work and temp. 1 for every tomcat instance.

share|improve this answer
add comment

Besides being the best way to run two tomcat instances, it makes easier to update.

I'm using this setup.

<!-- language: bash -->

/opt/apache-tomcat-7.0-32
/opt/apache-tomcat-7.0.39
/opt/apache-tomcat-7       (simbolic link to apache-tomcat-7.0.32)

CATALINA_HOME=/opt/apache-tomcat-7

/srv/user_deploys/tomcat_product_a
/srv/user_deploys/tomcat_product_b

CATALINA_BASE points to one or another deploy directory.

Basic binaries and libraries are on /opt/ Just copy server.xml, web.xml (and some other files, read the docs, please) and create directories bin,logs,webapps,temp,work (RTLM, L as lovelly, please)

You can update tomcat binaries, by modifying CATALINA_HOME on $CATALINA_BASE/bin/setenv.sh file for each instance or you can just modify the symbolic link, updating binaries "globally"

It's easier to update even if you have just one instance.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.