Forums Register Login

HFS: Problem with deploying and testing Beer-v1 App

+Pie Number of slices to send: Send
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

c:\tomcat\webapps\Beer-v1\form.html
c:\tomcat\webapps\Beer-v1\WEB-INF\web.xml
c:\tomcat\webapps\Beer-v1\WEB-INF\classes\com\example\web\BeerSelect.class

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.
+Pie Number of slices to send: Send
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).

Thanks
+Pie Number of slices to send: Send
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>
+Pie Number of slices to send: Send
Could you also post your deployment descriptor. Thanks
+Pie Number of slices to send: Send
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!!
+Pie Number of slices to send: Send
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="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http:/java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</select-class>
</servlet>

<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>

</web-app>
+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 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
https://gardener-gift.com


reply
reply
This thread has been viewed 1260 times.
Similar Threads
Deploying an app to Tomcat
Application not Available
Question on BeerAdvice example
Problems with the Example from HF Servlets & JSP in Chapter 3
Tomcat WebApp Deployment
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 02:31:10.