I am getting NoClassDefFoundError,whenever I try to call my servlet class. The error which is get is "java.lang.NoClassDefFoundError: com/example/web/BeerSelect (wrong name: BeerSelect)".
I am trying the example given in "Head First Servlets and JSP". Application is nothing but a form and from a drop down box an option is selected and Submit button is hit. It calls my servlet. I don't know why am i getting this error.
Is there any problem with CLASSPATH or JAVA_HOME variable. Please help.
It looks like you have compiled it incorrectly. It looks like you changed to the com/example/web/ directory and ran javac BeerSelect.java where you should be several levels up and run javac com/example/web/BeerSelect.java
If I remeber correctly (not having read the book) the instructions are quite explicit about where all the classes should be and how to compile the source, maybe read over this part again.
I appreciate for your reply. Well I have compiled my BeerSelect.java correctly and got my class file.I have copied my class file to the following path:- C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\Beer-v1\WEB-INF\classes\com\example\web