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 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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: 61092
    
  66

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: javax.servlet.ServletException: Wrapper cannot find servlet class