question on servlets
which two prevent a servlet from handling requests?
A. the servlet's init method returns a non-zero status.
B. the servlet's init method throws a ServletException.
C. the servlet's init method does NOT return within a time period defined by the servlet Container.
the correct options are B and C.
Could somebody explain me as to what exactly happens in case of option C?
the init Servlet method returns void type so it can't returns any non-zero status
I'm not sure that there's one specific, exact behaviour that containers must follow. It it really matters to you, I would test it with the specific version of the specific Servlet runner that you're using.
That said, I would expect reasonably behaviour be for the Servlet runer to send some appropriate HTTP status code such as 504 ("Gateway Timeout") back to the client.
Sorry but I the first my reply I hadn't understand correctly the question!:p
Perhaps It is possible that the servlet container doesn't response to client so client go in timeout.
I'm curious, tomorrow I try this behaviour with glassfish application server.
this code on glassfish server never returns(I wait it for 10 minutes).
public void init()
} catch (InterruptedException ex)
Logger.getLogger(index.class.getName()).log(Level.SEVERE, null, ex);
I think that the servlet container wait for init() method completions