• 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

Help with Head first sample code

 
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
I am working on the Chapter three example. I am trying to compile my BeerSelect.java file and I get these errors:

"package javax.servlet does not exist" for my import javax.servlet.* line
and
"package javax.servlet.http does not exist" for my import javaxservlet.http.* line.

I get other "cannot resolve symbols" errors but they come from package error.

I went back to the chapter one sample and it works if I enter
javac - classpath d:tomcat/common/lib/servlet-api.jar -d classes src/Ch1Servlet.java

I can get it to fail the same way if I leave off the "d:" in front of d:tomcat/common/lib/servlet-api.jar

I am working in Win2K.

I am in the d:/MyProjects/beerV1 folder and here is the actual command line I am trying to use.

javac -classpath d:tomcat/common/lib/servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

Thanks in advance.

Tim Rawerts
 
Ranch Hand
Posts: 1855
  • Number of slices to send:
    Optional 'thank-you' note:
Hi Tim,

try this on Windows:



Do you see it . You must change : with ; and use backslash

Regards,
Darya
[ August 03, 2005: Message edited by: Darya Akbari ]
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
OK, I will try, but why do the forward slashes work for the Chapter one example?
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
replacing the colon with the semi-colon seemed to take care of the problem. The forward slashes don't seem to be a problem. I had thought about that, and I should probably play with it, but that will have to be at a later date.

Thanks again for your help!!!

Tim Rawerts
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
OK, curiosity got the better of me

It doesn't matter if the slashes are forward slashes or back slashes, my file compiled into a class either way.

Thanks again!

Tim Rawerts
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
Boy this has been a long day

I copied my class to the /Beerv-1/WEB-INF/classes/com/example/web folder in the deployment structure, and when I try to test it out I get this:

HTTP Status 404 - /Beer-v1/form.html

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

type Status report

message /Beer-v1/form.html

description The requested resource (/Beer-v1/form.html) is not available.


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

Apache Tomcat/5.0.2


All files appear to be where they are supposed to be. Any ideas?

Tim Rawerts
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Number of slices to send:
    Optional 'thank-you' note:
Hi Tim,

there are more of these long days to come . Let's talk about development and deployment environments. Where in your deployment did you place your form.html page?

Regards,
Darya
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
For deployment, I have put my form.html under d:\tomcat\webapps\Beer-v1. It is at the same level as the WEB-INF folder.

Thanks again for your help Darya. I did not use these forums much for the SCJP, but it has already been a life saver for the SCWCD. And I am sure you are right, I will have many "head banging" days ahead.

Tim Rawerts
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Number of slices to send:
    Optional 'thank-you' note:
Hi Tim,

your form.html is in the right place. Do you see any exceptions in your tomcat window during tomcat start up?

Regards,
Darya
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
No. Tomcat appears to start properly. Everything else worked up to this point.

The last thing that worked was testing the page (#4 on page 76). The only things after that were the DD, and compiling the Servlet. The servlet compiles and since we don't even call the html I doubt it has anything to do with it. Would it be a good assumption that I did something wrong with my web.xml file?

I will go back over it and see if I fat fingered something.

Thanks again.
Tim Rawerts
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Number of slices to send:
    Optional 'thank-you' note:
Make sure that you try to open your page with http://localhost:8080/Beer-v1/form.html.

Your web.xml Deployment Descriptor (DD) belongs in your deployment WEB-INF directory.

On the other hand make sure that you follow each bit and byte of HFSJ's description for the Beer-v1 application, because all next exercises follow the same rules.

Regards,
Darya
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
Thanks again. It appears I am using the correct syntax for the url. I really can't (shouldn't) go forward until I figure this out. I will go over every detail with a fine tooth comb and see what I can come up with.

Tim Rawerts
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Number of slices to send:
    Optional 'thank-you' note:
Yes you should make this one your reference for every new web app to come.

Good Luck
Darya
 
Ranch Hand
Posts: 30
  • Number of slices to send:
    Optional 'thank-you' note:
I didn't go through the full thread..One mistake what I did was: Double clicking the form.html without typing the URL direcly on the webbrowser:
http://localhost:8080/Beer-v1/form.html

It didn't workout..I was banging my head for nearly an hour
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
No, I have been entering the url by hand. I see another thread that looks similar, so I will look at that. If I can't figure it out, then I am going to delete it all and start over.........




Thanks again.
Tim Rawerts
 
Tim Rawerts
Ranch Hand
Posts: 38
  • Number of slices to send:
    Optional 'thank-you' note:
Thanks again for all your help! I deleted everything and executed the exercise again and I got it to work!!!

These little successes in life keep us going!

Tim Rawerts

Oh yeah, it is time for a beer!
 
Darya Akbari
Ranch Hand
Posts: 1855
  • Number of slices to send:
    Optional 'thank-you' note:
Cheers!

Regards,
Darya
 
Ranch Hand
Posts: 179
  • Number of slices to send:
    Optional 'thank-you' note:
Hi

I am having the very same problem.
I have linux and tomcat 5.

When I replace : with ; like that:


I get the following error:


Please tell me what is wrong.
 
author
Posts: 9050
21
  • Number of slices to send:
    Optional 'thank-you' note:
first thing is to take out the space in front of the word 'servlet'

hth
 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Number of slices to send:
    Optional 'thank-you' note:
gee ... thanx
In the book the line wrapped before the 'servlet' and because it was my first time compileing a servlet I accidently assumed it was a space there.
 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Number of slices to send:
    Optional 'thank-you' note:
OK, but after submitting the form, i get 404 error for /~juhan/test/SelectBeer.do

I assume this is because of web.xml not beeing 100% right?
 
Ranch Hand
Posts: 146
  • Number of slices to send:
    Optional 'thank-you' note:
Hi Juhan,
You are just doing ok.
I followed your head hitting problems. I had the same problems
too initially. I had to drop the book for some days.
The first thing is that OS handle their file system
differently, i use winXP. When linux say :, win will say ;
Right.
So, Check your web.xml and make sure, the
<servlet-name>specified when declearing the name</servlet-name>
matches
the name specified in the servlet name of the servlet mapping (exact name)
Also, make sure the form action name is the same with the name specified
in the
<url-pattern>/select.do</url-pattern>

So keep coding, see you at the other end.

SCJP 1.4 SCJA 1.0 SCWCD( progressing)

 
Juhan Voolaid
Ranch Hand
Posts: 179
  • Number of slices to send:
    Optional 'thank-you' note:
Hello again

I got it working back there - thank you everyone, but now I have another question about that ...


What does this line "-classpath usr/local/tomcat/common/lib/servlet-api.jar:classes:." really say/do?

Do I have to compile that way simple javaBean classes allso?

What about if I am using Struts and I compile those Action and form classes?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic
vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |