Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First Servlets: Beer Problem

 
Benjamin Breeg
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
greetings,

Im trying our the example given in the Head First Servlets BEER SELECT example .

I have done everything as instructed in the TextBook ! Yet it will not work.

The error it displays is:
------------------------------------------------------------------------
type Status report

message /Beer/Beer.html

description The requested resource (/Beer/beer.html) is not available.

-------------------------------------------------------------------------

and that is just the Form1.html which i call as beer.html .... The webpage is displayed however, if i were to delete the web.xml !!!

can somebody explain this behavior and also help me get this application running successfully ? No beer for me till then
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64843
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Sign Of Aries",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Benjamin Breeg
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alrighty then how do i change it ? i changed the publicly displayed name and it still does not work !!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the directory structure of your webapp.
Also, please post the full path to your webapp on your machine's hard drive.
 
Benjamin Breeg
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\Beer:


---------------------------------------------------------------------------

Contents of Web.xml:

<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>Ch3Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Ch3Beer</servlet-name>
<url-pattern>SelectBeer.do<url-pattern>
</servlet-mapping>
</web-app>
-------------------------------------------------------------------------

i have followed the book in all regards .. but am wondering what i left out !! even the html page is not getting displayed

[BSouther: Added UBB CODE tags]
[ April 20, 2007: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that Tomcat is running?
What URL did you use when trying to access your app?
 
Benjamin Breeg
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat is running and the URL i used is:

http://localhost:8080/Beer/beer.html
 
Scott Escue
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at your Tomcat logs, I believe you may be getting any error when Tomcat tries to start your webapp.

Take a look at your web.xml. The SchemaLocation url in your opening web-app tag is slightly off:
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2.4.xsd"

should be:

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
[ April 20, 2007: Message edited by: Scott Escue ]
 
Benjamin Breeg
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<url-pattern>SelectBeer.do<url-pattern>

BAD XML !!! i forgot to close the tag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic