wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Getting Tomcat to recognize directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Getting Tomcat to recognize directory" Watch "Getting Tomcat to recognize directory" New topic
Author

Getting Tomcat to recognize directory

jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
I have created the following directory structure:
C:\tomcat\webapps\mywebapp\index.html
Restarted tomcat, and when I type:
http://localhost:8080/mywebapp/
or
http://localhost:8080/mywebapp/index.html
in a browser, I get a 404 error.
According to everything I have read, Tomcat first looks in the ROOT directory for the location, and if not finding it there, it looks in CATALINA_HOME/webapps/ for the directory.
I have set up an environmental variable CATALINA_HOME=c:\tomcat
And all my jars and JDK's are set in the pathing, also. I can see
http://localhost:8080/examples/
http://localhost:8080/webdav/
fine, just not the folder I created. Anything else I need to do?? (none of the books I am reading or tutorials state there is anything extra, this SHOULD work)
Thanks!
Jason
Jim Petersen
Ranch Hand

Joined: Jul 24, 2001
Posts: 241
Hi Jason
Have you included a WEB-INF sub directory in this structure? ie:
C:\tomcat\webapps\mywebapp\WEB-INF\
C:\tomcat\webapps\mywebapp\index.html
then restart TC and try
At this stage it does'nt matter that there is nothing in WEB-INF, just as long as Tomcat can see
it when it starts up
I'm not sure why it does this though I'd like to know - I don't feel that cool telling people "It just does OK?!"
- Any one else?


- Jim Petersen <br />SCJP2<br />SCWCD<p>- but then again, I could be wrong...
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Yup, already had that in there, even put in a web.xml that gave my app a servlet mapping. That's why I'm quite perplexed.
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Think I found my problem. I don't think I rebooted my machine after putting in the environment variable CATALINA_HOME. Didn't think that would make a difference, but it's now working, so obviously it does. How odd.
Thanks anyways Jim
Jason
Jim Petersen
Ranch Hand

Joined: Jul 24, 2001
Posts: 241
Whew! I was just about to suggest start trawling the TC logs and see what was happening inside...
- good to hear Jason
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
Sorry guys, but I have the same problem you had. Could you pls go back to the discussion
I can see all the URL's you mentioned using my browser, but the folder I created is not recognized. I just rebooted my pc and nothing.
Mi structure is like this:
.
.
.. webapps
|-- examples
|-- manager
|-- openjms
|-- index.html
|-- WEB-INF
|-- web.xml
|-- index.html
.
.
.
openjms is the folder I created, but it does not recognize it. I have set up the CATALINA_HOME to C:\jakarta-tomcat-4.0.1. Any other ideas??
the error I get in the browser is:
Apache Tomcat/4.0.1 - HTTP Status 404 - /openjms
type Status report
message /openjms
description The requested resource (/openjms) is not available.


I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
sorry guys, my tree is all screwed up
anyway. it's somethin' like this:
webapps/openjms/WEB-INF/index.html
webapps/openjms/WEB-INF/web.html
and I even have an index.html in
webapps/openjms/index.html
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
actually, I discovered the problem was with my web.xml file, not with the whole rebooting the pc. Looks like you might be having the same thing. First, you have web.html and not web.xml, second, if you do actually have a web.xml file, I think you might be missing the <?xml...> tag (or is that an entity?>
Do this. Copy the web.xml file from the ROOT/WEB-INF folder, and put it in the WEB-INF folder under the directory you created. Overwrite or remove any web.xml (or web.html) file that you have in there. Restart Tomcat and see if that works.
Hope it helps!
Andres Gonzalez
Ranch Hand

Joined: Nov 27, 2001
Posts: 1561
yeahhhh!!! it worked. I followed your steps, rebooted my pc and now it is recognizing it. So the problem was with my web.xml file, I probably modified it and inserted an error in it...
thanks 4 ur help!!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Tomcat to recognize directory
 
Similar Threads
404 - Page not found ??
taglib directive
How to see my html file in my own directory
IIS and TOMCAT
setting index.html to my context root