• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javax.servlet.ServletException: Wrapper cannot find servlet class

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65125
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 138
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic