I am very new to tomcat and trying to get my very first web application up and running. This is the web app from the book Head First Servlet and JSP named Beer-v1(Chapter 3: Hands on MVC)
Tomcat version: 5.0.28 Platform: Windos 2000 Problem: I have following structure
When I start the tomcat service and try to run my web app via IE http://localhost:8080/Beer-v1/form.html , it gives me resource could not be found error. If while tomcat is running, I create another folder under webapps and copy my form.html there and invoke it via IE it works fine. But if I stop and restart the tomcat service this also stops working.
i even made a copy of one of example application that comes with tomcat, that also act the same. I know, I am doing something wrong and not setting some configuration files. Please help. It's stopping me from doing lots of handon and understaning key concepts.
Hi, One of the reasons could be : Trying to call doPost(...) instead of doGet(..). I suggest you have both methods and calling the one from other to test it out whether it is not the issue. If you figure out that is the issue, then you know why it is so(because HF says when doGet() / doPost() gets invoked).
I am using the post method in my form as mentioned in the example in Chapter 3 Here si the html for the form --------------------------- <HTML> <BODY> <h1 aligh="center">Beer Selection</h1> <form method="POST" action="SelectBeer.do"> Select Beer Characteristics<p> Color: <select name="color" size="1"> <option> light <option> amber <option> brown <option> dark </select> <br><br> <center> <input type="submit"> </center> </form> </BODY> </HTML>
I had a problem trying to do the same thing. I renamed my Beer-v1 to Beer and everything worked for me. I don't know if this is the problem for you but you can always give it a try!!
Since I am working on this at home, I do not have access to that very file but here I typed in what that file has. It is from HFS chapter 3 Handon MVC sample application. (I may have done a typo)
As i mentioned, when i made a copy of tomcat sample application jsp-examples and named it "b". it worked until i restarted my tomcat service. The same problem i get with my sample application. It almost like app is not getting auto deployed or getting some error and not getting deployed.( I can understand error in my app but copy is tomcat sample app should have everything right). So I am ruling out error theory. Now there could be a step in deployment i might be missing but i did exactly what they said in book.
Thanks patrik, I did try renaming to remove the - but still the same issue. If I start the tomcat and then copy form.html file under beer-v1 app it works fine until i stop and restart the tomcat.
I am assuming with so many people going through HFS they must have tried the sample app "hands on". then why it only me who it getting the error? May be its only me who is so ignorant about tomcat working and setup.
Thanks for your help and insight into tomcat. tomcat Manager did help a lot. I was able to find out the problem and correct it. It is nice to know that your application is correctly deployed and running before accessing it via IE. Thanks once more
Post by:autobot
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
a bit of art, as a gift, that will fit in a stocking