• 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

HFSJ example error

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I just started reading HFSJ book and I am having trouble compiling the servlet on P84. Tomcat 5.5 is setup on my machine and the previous examples are working properly. But for this one, with the 'import com.example.model.*;' line added, I've got a compiler error -

========================================
src\com\example\web\BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
src\com\example\web\BeerSelect.java:20: cannot resolve symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
src\com\example\web\BeerSelect.java:20: cannot resolve symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
3 errors
===============================================

and also for the example between pages 170-180, that is the Dog example, I get the same error like the one above when I compile the MyServletContextListener.java. that is "the Dog class was not found" error.

What should I import to make the MyServletContextListener see the Dog class. Can anybody help?
A fast reply is much appreciated.

Thank you!!
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you checked whether you have the classes in the folder named "classes" (with proper package structure )
 
yoga eesh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Everything is ok. All folder names and packages are exactly as mentioned in the HFSJ book. Whats the exact import statement I should use in the MyServletContextListener class so that the Dog class is visible to it?
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yogaeesh I have sent you an exact directory structure along with the code, just copy it in your webapp folder and access it using

http://localhost:8080/beerv2/form.html

Check your venkitron@yahoo.com account
reply
    Bookmark Topic Watch Topic
  • New Topic