Discussion
When a servlet cannot be instantiated by the servlet container, which exception is thrown to the servlet container methods such as init() or service() ?
Answer: D
The answer is None of these.
In the Servlet API, the life-cycle methods signal failure with ServletException and its subclass UnavailableException, which tells the container that the servlet cannot be put into service, temporarily or permanently. Neither is offered.
InstantiationException is a general Java reflection exception raised when a class cannot be instantiated; it is not what init() or service() throw. ServletInitializationException is not a class in the Servlet API. IllegalStateException is thrown when a method is called at the wrong time, for example sending a redirect after the response has been committed.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development