I just installed Ubuntu 12 along with LAMP. I am trying to walk through all the steps necessary to get a new web project picked up by apache/tomcat. 1) to test to see if it can find a .html file 2) if I can load a test servlet that I deploy. I am reaching out for help as I have messed up the configuration 2 times already, and thought I better get some help before I mess something else up.
The name of the project is called "samples"
1) I went to /var/lib/tomcat6/conf/Catalina/localhost to create a samples.xml file to match what was there:
-rw-r--r-- 1 root tomcat6 922 Dec 13 2011 docs.xml
-rw-r--r-- 1 root tomcat6 78 Dec 13 2011 examples.xml
-rw-r--r-- 1 root tomcat6 958 Dec 13 2011 host-manager.xml
-rw-r--r-- 1 root tomcat6 948 Dec 13 2011 manager.xml
-rw-r--r-- 1 tomcat6 tomcat6 51 Feb 6 12:48 ROOT.xml
-rw-r--r-- 1 root root 65 Feb 6 13:36 samples.xml
/var/lib/tomcat6/conf/Catalina/localhost# more samples.xml
<Context path="/samples" docBase="/var/lib/tomcat6/webapps" />
2) in /var/lib/tomca6/webapps/samples, I added a index.html file (copied the one from ROOT) that gets displayed and changed a few text words in it.
3) I added a WEB-INF dir with a web.xml
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
<description>This is my sample application</description>
Should be /var/lib/tomcat6/webapps/samples. In other words, the docBase is the path to the webapp (WAR), not the directory containing it. Don't be confused by the "path" attribute. It's what Tomcat will use to route URLs, not what Tomcat will use to locate code. Except when Tomcat ignores it, which is another annoyance entirely.
An IDE is no substitute for an Intelligent Developer.