aspose file tools*
The moose likes Servlets and the fly likes Cannot load the servlet class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Cannot load the servlet class" Watch "Cannot load the servlet class" New topic
Author

Cannot load the servlet class

lokesh rajarathnam
Ranch Hand

Joined: May 17, 2007
Posts: 35
Hi every one...


The error "Cannot load the servlet class : <package>.loginservlet"

How to overcome this prob...

I think the .class file is missing or cannot created...

What could be the prob....?
[ July 14, 2008: Message edited by: Bear Bibeault ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Did you want to share first?

Where is the class file located? is it located at <context>/WEB-INF/classes/<package>/LoginServlet

(note the capitalisation in the class name, by convention this is preferred and encouraged rather than all lower case)
lokesh rajarathnam
Ranch Hand

Joined: May 17, 2007
Posts: 35
Hi David...

the project... <project name>/src/<package>/loginservlet.java

after deploying this i get "ClassNotFoundException" (error 500,)
and Internal problem occur.
Later i add servlet-api.jar to my project lib folder... then also the same problem....

what can i do... ? How to over come...?
lokesh rajarathnam
Ranch Hand

Joined: May 17, 2007
Posts: 35
Originally posted by lokesh rajarathnam:
Hi David...

the project... <project name>/src/<package>/loginservlet.java

after deploying this i get "ClassNotFoundException" (error 500,)
and Internal problem occur.
Later i add servlet-api.jar to my project lib folder... then also the same problem....

what can i do... ? How to over come...?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Did you compile your servlet source to create a class file?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
sudhir nim
Ranch Hand

Joined: Aug 29, 2007
Posts: 212

Look at Web application directory structure. It explains where to put the compiled classes and JAR files.

Make sure that the class file is inside WEB-INF/classes directory.


[Servlet tutorial] [Servlet 3.0 Cook Book]
 
jQuery in Action, 2nd edition
 
subject: Cannot load the servlet class