MySQL connection problems on Tomcat




My web start application connects to a MySQL database through a servlet. The servlet accesses the database through a MySQL connector instance and returns the results the client if necessary. Everything is done through a Tomcat Linux web server.

My problems seem to occur when I run the program through the servlet for the first time after a while, like the first time of the day or after not testing it on the server for some days. It can't fetch anything from the database, so the client just gets null objects back. Ultimately, a NullPointerException kills the application as it has nothing to work with.

The solution is very simple. I shut down Tomcat and restart it, after which it again reads results from the database as it should. This is just not a sustainable way to deal with it.

My employer wants to deploy it such that many different users will have an interest in accessing it from various places and not just people with system administrator privileges. Hence, crashes are liable to make them spurn the application. That would make quite a lot of work useless.

Do you know the source of the mentioned problem?

Regards.

--
Newsoffice.de - Die Onlinesoftware zum Lesen und Schreiben im Usenet Die Signatur läßt sich nach Belieben anpassen ;-)
.



Relevant Pages

  • Re: A2LL ist tot...
    ... | mit Tomcat als Servlet Container. ... | # Bugs - You think you have a bug or there is a difference in behavior with another servlet container. ... | # Database - Getting tomcat to talk to a database. ...
    (de.talk.tagesgeschehen)
  • Running a job through a Servlet
    ... I would like to kick of a very long running process. ... by this job are instatiated through a spring context. ... we have that we run locally that brings data in from one database, ... a servlet and let it continue to run when I end a browser session. ...
    (comp.lang.java.programmer)
  • Re: Is it bad to connect to a database via an applet?
    ... I want to write a game in an applet that ... utilizes a database. ... Do I have a middle page, a servlet, that sits on the server ... The simplest safe way to get the data from the db on the server to your applet on the client is to build a servlet as your middleware. ...
    (comp.lang.java.programmer)
  • Re: Creating new thread from servlet
    ... I have a Java servlet running in Tomcat that is a form. ... into a database. ... time to execute, thus the submission of the form takes a long time. ... Start the threaded task and cache the thread-id or the runnable object or thread complete flag with some unique key ...
    (comp.lang.java.help)
  • Re: java.lang.OutOfMemory Error
    ... > In a servlet, I am reading from the database and writing to PrintWriter ... The database returns around 50,000 rows. ... > as there are no object creations inside the loop and I am re-using the ...
    (comp.lang.java.programmer)