jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes javax.servlet.ServletException: Wrapper cannot find servlet class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "javax.servlet.ServletException: Wrapper cannot find servlet class" Watch "javax.servlet.ServletException: Wrapper cannot find servlet class" New topic
Author

javax.servlet.ServletException: Wrapper cannot find servlet class

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Hello,

The following is my class code: the code don't have any error and class resides in package globalcategories.classes



my WEB-INF


When I ran servlet then its throwing following exception:


Thanks in anticipation

Best regards
Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

The servlet-class element should have fully qualified class name of the servlet.

Also, put a default constructor explicitly since there is a custom constructor in the class.


Regards,
Prajakta
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60802
    
  65

Prajakta Acharya wrote:Also, put a default constructor explicitly since there is a custom constructor in the class.


Why is there a constructor? Servlets should never have constructors.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Hello,

I change WEB-INF as follow:


and now its giving following exception:



I removed constructor and its working fine now

Thanks again
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 732
Bear Bibeault wrote:
Prajakta Acharya wrote:Also, put a default constructor explicitly since there is a custom constructor in the class.


Why is there a constructor? Servlets should never have constructors.


You are very right

Thanks for favoring

Prajakta Acharya
Ranch Hand

Joined: Nov 08, 2012
Posts: 138

Oops.....yes, servlet shouldn't have a constructor at first place.
Sorry for that.

Just imagined what will be the next error once a fully qualified class is referred in web.xml.
Container will not be able to instantiate it and wrote that.

But yes, the constructor should not be there.
 
 
subject: javax.servlet.ServletException: Wrapper cannot find servlet class
 
Similar Threads
Wrapper ServletException
Constructor Problem
Error 404
FrontMan: Startup Error.
http error?