Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need a walkthrough for Ubuntu / Tomcat 6 to create a new web project

 
Steven Mac
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

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

with contents:

/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

samples/WEB-INF

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>Samples</display-name>
<description>This is my sample application</description>

<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

4) When I try http://localhost:8080/samples , I get a 404 error. http://localhostt:8080/examples still works though.

Is there something else in the system that must be specified to make the index.html file work?

Thanks for your expertise and help.. Steven




 
Tim Holloway
Saloon Keeper
Pie
Posts: 18272
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic