Servlets and JDBC
From: Xarky (bernardpace_at_yahoo.com)
Date: 12/11/04
- Next message: Jean-Marc Vanel: "Re: federate several datasources"
- Previous message: Manuel J. Goyenechea: "Re: Advice on persistent storage in Java"
- Next in thread: Juha Laiho: "Re: Servlets and JDBC"
- Reply: Juha Laiho: "Re: Servlets and JDBC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 11 Dec 2004 05:45:33 -0800
>> System.err.println(e);
>> e.printStackTrace();
>> System.exit(16);
> You shouldn't use System.exit in a Servlet. You don't want to bring the
> server down for every error.
The System.exit was removed and now my tomcat is not disconnecting.
>> When DB class is run from console mode, with the same query, it
works
>> perfect. When applied to servlet, the servlet is failing at the
>> Connection stage and my Tomcat is being disconnected. Why?
> Possible different permissions if tomcat runs as a service.
Also, after having removed the system.exit part, my programs seems to
connect and now it is failing in the try catch part. Error being
returned in web browser is the follwoing.
HTTP Status 500 -
--------------------------------------------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented
it from fulfilling this request.
exception
java.lang.NullPointerException
ListBooksServlet.doGet(ListBooksServlet.java:42)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
filters.ExampleFilter.doFilter(ExampleFilter.java:101)
note The full stack trace of the root cause is available in the Apache
Tomcat/5.0.30 logs.
--------------------------------------------------------------------------------
Apache Tomcat/5.0.30
>> Another question... in the database class when an error occurs in
the
>> catch statement, in console mode is displayed easily. How can this
be
>> done in servlets.
> Catch exceptions at the highest level (class ListBookServlet) and format
> the backtrace into HTML so that you can see it in the browser.
Can you give me a simple example of what you mean because I can't
understand it.
- Next message: Jean-Marc Vanel: "Re: federate several datasources"
- Previous message: Manuel J. Goyenechea: "Re: Advice on persistent storage in Java"
- Next in thread: Juha Laiho: "Re: Servlets and JDBC"
- Reply: Juha Laiho: "Re: Servlets and JDBC"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|