This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Tomcat to recognize directory

 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
jason adam
Chicken Farmer ()
Ranch Hand
Posts: 1932
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1932
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 241
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1932
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1561
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic