• 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

Getting Tomcat to recognize directory

 
Chicken Farmer ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ()
Posts: 1932
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!!
 
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic