This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes init () method throws exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Servlets
Bookmark "init () method throws exception" Watch "init () method throws exception" New topic

init () method throws exception

Raj Jindal
Ranch Hand

Joined: Jan 17, 2003
Posts: 50
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
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
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.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
GeeCON Prague 2014
subject: init () method throws exception