File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Tomcat doesn't find sevlet I know is there Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat doesn Watch "Tomcat doesn New topic
Author

Tomcat doesn't find sevlet I know is there

Charles Knell
Greenhorn

Joined: Mar 19, 2006
Posts: 25
I'm working my way through Head First Servlets and JSP. I am in Chapter 3.

When I call the servlet,Tomcat reports this error:

root cause

java.lang.ClassNotFoundException: com.example.web.BeerSelect


The relevant portion of my web.xml file is:


There are two packages involved. The first contains a single class declared:


The second also contains only one class declared as:


Both compiled successfully and I placed the .class files in these directories:
  • Tomcat 5.5/webapps/Beer-v1/com/example/model/BeerExpert.class
  • Tomcat 5.5/webapps/Beer-v1/com/example/web/BeerSelect.class



  • I have stopped and re-started Tomcat after placing the files in the directories noted above.
    Can someone tell me, based on this information, where I'm going wrong?

    [ March 23, 2006: Message edited by: Charles Knell ]
    [ March 23, 2006: Message edited by: Charles Knell ]
    Manesh Kumar
    Ranch Hand

    Joined: Mar 21, 2006
    Posts: 94

    Tomcat 5.5/webapps/Beer-v1/classes/com/example/model/BeerExpert.class
    Tomcat 5.5/webapps/Beer-v1/classes/com/example/web/BeerSelect.class


    Should have under WEB-INF folder

    Tomcat 5.5/webapps/Beer-v1/WEB-INF/classes/com/example/model/BeerExpert.class
    Tomcat 5.5/webapps/Beer-v1/WEB-INF/classes/com/example/web/BeerSelect.class

    Also web.xml should also be under
    Tomcat 5.5/webapps/Beer-v1/WEB-INF


    Then try to restart the server.


    Manesh
    Charles Knell
    Greenhorn

    Joined: Mar 19, 2006
    Posts: 25
    Originally posted by Dilip Kumar Jain:


    Should have under WEB-INF folder

    Tomcat 5.5/webapps/Beer-v1/WEB-INF/classes/com/example/model/BeerExpert.class
    Tomcat 5.5/webapps/Beer-v1/WEB-INF/classes/com/example/web/BeerSelect.class

    Also web.xml should also be under
    Tomcat 5.5/webapps/Beer-v1/WEB-INF

    Thanks. I've just got too many balls in the air to keep track of everything. It always happens this way when mastering a new skill. I'll remember this now.
    Then try to restart the server.

    [Bear edit: fixed quoting problem]
    [ March 23, 2006: Message edited by: Bear Bibeault ]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Tomcat doesn't find sevlet I know is there