File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Need a walkthrough for Ubuntu / Tomcat 6 to create a new web project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Need a walkthrough for Ubuntu / Tomcat 6 to create a new web project" Watch "Need a walkthrough for Ubuntu / Tomcat 6 to create a new web project" New topic
Author

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

Steven Mac
Greenhorn

Joined: May 27, 2010
Posts: 13
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

Joined: Jun 25, 2001
Posts: 16065
    
  21



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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need a walkthrough for Ubuntu / Tomcat 6 to create a new web project