This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Background: I'm setting up a local copy of an existing app because i need to do some modifications on it. Its a jsp site with a postgres backend. I checked the live setup and it was kind of weird for me( likely due to my lack of knowledge). I noticed that the tomcat setup there did not have any war file and has no application on webapps folder and I noticed that the ROOT.xml was modified.
the ROOT.xml was modified:
and so the docbase was change to a different directory. I was wondering what implications this would have?
Secondly I noticed that the tomcat i downloaded did not have a <tomcat-dir>/conf/Catalina/localhost directory; and then if I used aptitude or yum tomcat is thrown all over the place. part is in /etc and some are in /usr/shared and some in /var. I opt to manually download the tomcat and extract. On ubuntu the Catalina/localhost is on /etc/tomcat6/Catalina. So concerning this, I wish to verify what Catalina is used for and if this is the same directory as Catalina home.
I'm sorry if my questions seem a bit basic for some. I've gotten used to just using ubuntu's aptitude and just deploying wars to the webapp directory so I'm not familiar with the details of tomcat. I appreciate any help.
You should find that /home/tomcat/app is what's known as an "exploded WAR". Tomcat supports running webapps whose WAR files have been unzipped, although this is not part of the J2EE spec. Despite the fact that this is a directory instead of a file, there should still be a WEB-INF subdirectory with classes and lib under it, although people have been known to create "dirty" WARs and leave these essentials out.
The stock distro for Tomcat is that everything is located under a single directory root. For people running multiple Tomcats, they can clone this structure and strip out the sharable parts and define CATALINA_HOME and CATALINA_BASE to reflect the differences.
OS packaging of Tomcat can take this one step further. A simple way to install Tomcat is to simply unzip/tar it to the /usr/local or /opt directory. But OS packages often prefer to arrange files more in accordance with the Linux filesystem standard. Which means things like not putting mutable files under /usr/local, putting config files under /etc, workfiles under /var, logfiles under /var/log and so forth. That's fine, but since Tomcat is coded for the other way, the package installers will often create these various files in their "proper" locations, and then construct softlinks from the master location to the actual location. So, for example, /usr/local/tomcat6/conf might link to /etc/tomcat6/conf, /usr/local/tomcat6/work could be /var/work/tomcat6 and so forth.
That way both the OS purists and Tomcat are happy. And, as long as you use the package manager to maintain things, no problems. If you start playing around manually with these items, however, it's best if you have good understanding of what you're doing.
In Ubuntu, the "dpkg" command will show you where things got put, I believe. In the Red Hat versions, the "rpm -qil xxxx" command will do it (substitute the package name for "xxx").
It's not actually essential that TOMCAT_HOME/conf/Catalina/localhost exist, but it does, it will be searched for deployed webapps. Also, if you're running a Tomcat with multiple hosts, there may be other deployment directories as well, but let's leave that for another day.
An IDE is no substitute for an Intelligent Developer.
Joined: Sep 25, 2010
Thanks for the concise reply. It helped me alot. and sorry for the late reply.