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 404 for .html in Tomcat 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "404 for .html in Tomcat 5" Watch "404 for .html in Tomcat 5" New topic
Author

404 for .html in Tomcat 5

J Chitra
Greenhorn

Joined: Sep 16, 2004
Posts: 18
Hi all,
I have just installed Tomcat 5.0.28 and tried to axs a simple HTML page (tomcat/webapps/Project/form.html) thru localhost:8080/Project/form.html. Am getting a 404 error. I have nothing else in the 'Project' directory. Even when i tried naming the 'Project' directory a different one and tried to axs the HTML page, getting the same error!
can anyone explain?
CJ


SCJP(1.4)
J Chitra
Greenhorn

Joined: Sep 16, 2004
Posts: 18
And I forgot to add:
Tomcat 5.0.28 works just fine with al the examples and this is just a simple static web page.
Many Tnx.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61658
    
  67

What does it mean to "ax" a page?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi CJ,

And I forgot to add:
Tomcat 5.0.28 works just fine with al the examples and this is just a simple static web page.
Many Tnx.



You need to create a WEB-INF subdirectory under PROJECT, i.e. /PROJECT/WEB-INF for the Tomcat to deploy the application. Since it's only html static pages, a web.xml file is not required under WEB-INF directory.

Alternatively, without the WEB-INF subdirectory, you still can access the html static pages by deploying the application manually using Tomcat Manager. Or you can add a Context under C:\tomcat-5.0.28\conf\Catalina\localhost. The first approach, just create a WEB-INF directory, is preferable.

Joyce
[ October 28, 2004: Message edited by: Joyce Lee ]
J Chitra
Greenhorn

Joined: Sep 16, 2004
Posts: 18
Hi Joyce,
Many thanks. But its not still working.Even I added a web.xml to the WEB-INF under Project. Its not sill working.

Hi Bear,
axs=access.
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
Hi CJ,

Many thanks. But its not still working.Even I added a web.xml to the WEB-INF under Project. Its not sill working.
Make sure the Tomcat has been shutdown before making the changes. If it is still not working, how about you try the following method?

Assuming that the http://localhost:8080/servlets-examples/helloworld.html is working fine. Make a copy of "servlets-examples" directory under webapps and rename it to any name, e.g. testing. So now under webapps, a new application called "testing" is created and its contents are similar to servlets-examples. Startup the tomcat and see if you can run this new application http://localhost:8080/testing/helloworld.html.

Joyce
J Chitra
Greenhorn

Joined: Sep 16, 2004
Posts: 18
Its working. The server was not shutdown the last when i made the changes in the PROJECT directory.
Thanks Joyce.
Sirisha Reddy
Ranch Hand

Joined: Jun 09, 2003
Posts: 75
I ran into the same problem.. and it was solved after adding web-inf folder.

But what is the logic behind it.. any comments.

Sirisha
[ November 15, 2004: Message edited by: Sirisha Reddy ]

SCJP 1.4
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5545
    
  13

Originally posted by Sirisha Reddy:
But what is the logic behind it.. any comments.

Sirisha


Tomcat is really picky on this, so for each webapp, you must have a WEB-INF directory underneat it, because else it won't work. no other logic


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: 404 for .html in Tomcat 5