Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HFSJ example error

 
yoga eesh
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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!!
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Gaurav Gambhir
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic