• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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




 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic