File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
I agree. Here's the link:
subject: init () method throws exception
jQuery in Action, 3rd edition