Rashmi,
You're right. The example you gave throws an exception and it shows
in the localhost log file.
Either Turbine or one of my filters must be trapping the exception. I
was tracing it through with a debugger, but must have missed
something.
Thanks for your help.
WILL
On 3/30/07, Rashmi Rubdi <[EMAIL PROTECTED]> wrote:
On 3/30/07, Will Glass-Husain <[EMAIL PROTECTED]> wrote:
> I just concluded a frustrating debugging session in which a servlet
> was throwing a ServletException in the init method.
How do you know that the Servlet was throwing an Exception in the init method ?
> No error messages
> in any log file. (tomcat\logs\*) The localhost log file was empty.
> There was some various items in the stdout and the catalina log file.
> None mentioned the problematic servlet.
Is the web.xml present for this project? Does the web.xml have the
Servlet name and URL pattern defined? I temporarily disabled web.xml
and tried to access the Servlet -- it gave a 404 error and nothing
else was logged in catalina out or the console (this is expected
behavior).
Anyway, I tried a small test, and I was able to see an Exception
message both on the web page for this Servlet and in catalina log
file.
package test61;
import javax.servlet.*;
public class TestServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
try {
int test = 5;
int divideByZeroError = test / 0;
} catch (Exception e) {
throw new ServletException("Divide By Zero Exception in
init method: ", e);
}
}
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws ServletException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException {
//nothing
}
}
The above was tested on Tomcat 6.0.x ZIP install (not Windows Service)
on Windows XP , with full JDK (not JRE)
-Rashmi
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Forio Business Simulations
Will Glass-Husain
[EMAIL PROTECTED]
www.forio.com
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]