• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Head First Servlets: Beer Problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
alrighty then how do i change it ? i changed the publicly displayed name and it still does not work !!
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat is running and the URL i used is:

http://localhost:8080/Beer/beer.html
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<url-pattern>SelectBeer.do<url-pattern>

BAD XML !!! i forgot to close the tag
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic