Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

javax.servlet.ServletException: Wrapper cannot find servlet class

 
Ranch Hand
Posts: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 138
Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 851
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic