File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HFS: Problem with deploying and testing Beer-v1 App Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HFS: Problem with deploying and testing Beer-v1 App" Watch "HFS: Problem with deploying and testing Beer-v1 App" New topic

HFS: Problem with deploying and testing Beer-v1 App


Joined: Dec 10, 2004
Posts: 9
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
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.
Premkumar Gopal

Joined: Jun 12, 2004
Posts: 22
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).


SCJP(1.4), OCP(8i) DBA, Websphere Certified Associate Developer, Websphere Certified Solution Developer, Websphere Portal Application Developer

Joined: Dec 10, 2004
Posts: 9
I am using the post method in my form as mentioned in the example in Chapter 3
Here si the html for the form
<h1 aligh="center">Beer Selection</h1>
<form method="POST" action="">
Select Beer Characteristics<p>
<select name="color" size="1">
<option> light
<option> amber
<option> brown
<option> dark
<input type="submit">
Premkumar Gopal

Joined: Jun 12, 2004
Posts: 22
Could you also post your deployment descriptor. Thanks
Patrik Nilsson
Ranch Hand

Joined: Oct 05, 2004
Posts: 49
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!!

Sun Certified Java Programmer<br />Sun Certified Web Component Developer<br />IBM Certified Enterprise Developer

Joined: Dec 10, 2004
Posts: 9
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.

<web-app xmlns=""

<servlet-name>Ch3 Beer</servlet-name>

<servlet-name>Ch3 Beer</servlet-name>


Joined: Dec 10, 2004
Posts: 9
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.

Hey guys, please help!
Nitish Bahadur
Ranch Hand

Joined: Aug 25, 2003
Posts: 118
1. What version of Tomcat are you running? (I have 5.0.28)
2. Access Tomcat Manager, using http://localhost:8080/manager/html. Enter the userid/password, if asked. (admin/admin is default)
3. Do you see /Beer-v1 in Tomcat Web Application Manager?
4. Stop /Beer-v1 (not Tomcat, just the web-application)
5. Try accessing http://localhost:8080/Beer-v1/form.html. (should fail!)
6. Start /Beer-v1, and access http://localhost:8080/Beer-v1/form.html (works???)
7. Please let us know the Server Information listed at the bottom of the http://localhost:8080/manager/html page.

Joined: Dec 10, 2004
Posts: 9
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
I agree. Here's the link:
subject: HFS: Problem with deploying and testing Beer-v1 App
jQuery in Action, 3rd edition