This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
It is sorta covered in the JavaRanch Style Guide.
subject: init () method throws exception
Similar Threads
init() called for only once for one servlet instance ?
getServletConfig() does not work
Lazy initialization of the servlet
Servlet init method behavior
init method