Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

init () method throws exception

 
Raj Jindal
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If there is a request for that servlet and there is no instance of that servlet in the servlet container then it will create a new instance
If the init() method of a servlet throws some exception what will happen.Will the servlet serve to the request or what exception will occur and displayed to the user.
Thanks in advance
Raj
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Throwing an exception in th einit method is defined in the spec as meaniong that the servlet cannot start, and should never be used. The container will never route any requests to the servlet, and should issue an HTTP error if a URL is requested which maps to it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic