Dear Ranchers, I am also experiencing the same problem in getting a html page to be displayed in the browser as others had reported in an earlier thread. I created a directory myapp under tomcat/webapps and had only a html page ( index.htm ) in that directory. But when i access the file with the url - "http://localhost:8080/myapp/index.htm" , the browser throws a 404 - Page not found error. I have made sure that there was no spelling mistakes in the url. Also i dont have any other files or directories under myapp except the index.htm file. But the same setup works when i have myapp under tomcat/ROOT.
I saw kathy replying in the other thread that
you really should put "Beer-v1" inside the webapps directory, not at the tomcat root!
Why is it not a really good idea to place it under ROOT ?
I am able to access the other files like jsp-examples./index.htm which is directly under webapps. How is this possible since I am not able to get my page when it is under webapps directly. What could be the cause ? Am i missing something with the classpath ?
Can some one throw light on how tomcat finds out which page to serve the browser when a request comes in ? I mean how does it know that the myapp/index.htm as in the url above is indeed under webapps only.
and a valid Deployment descriptor webapps/[YOUR_APPLICATION_NAEM]/WEB-INF/web.xml
In webapps directory, tomcat will not deploy any appliction without a valid deployment descriptor (even if there is a typo in dd, it will not be deployed). I believe if you put in ROOT then it will server the static contents even if it does not have a valid DD.
Look for deployment error messaes when you start up tomcat or to go to http://localhost:[YOUR_PROT_HERE]/manager/html and see a list of applicatins deployed succesffuly (You will have to provide username and password for manager role to go to this link)
Actually, its ok even if you do not have a web.xml file since Tomcat uses its default one. But make sure you add a WEB-INF folder under webapps/Your_application. Otherwise, tomcat will not recognize your application and it will throw a 404 error.
After creating a WEB-INF directory under myapp, i am able to get the html page even though there is no web.xml in the WEB-INF.
Can any one provide any links to how actually tomcat is doing all these things in the background. I really like to know how something happens rather that be content with "do like this and it will happen" !
I managed to solve it eventually but there are still a couple of unanswered questions?
If I name the Beer directory Beer or even Beer-v it works but I can't have 2 characters after the - . not Ber-v1 Strange?? I also tried without he WEB-INF dir and it works fine there as well. Guess I rename my directory instead but it seems very strange.
Sun Certified Java Programmer<br />Sun Certified Web Component Developer<br />IBM Certified Enterprise Developer
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?