On a webserver i have following situation: - 2 instances of Tomcat 5.0.28 installed in 2 different maps (TomcatA en TomcatB under C:\Program Files\Apache Software Foundation) - the latest JDK version: jdk1.5.0 update 4 - Each Tomcat instance starts up with following extra parameters: -Xms1568m -Xmx1568m
Starting them up causes no problems, but after some time (it's not on a regular base) TomcatA is hanging and you can't do anything more in the web-application. The only thing you can do is stop tomcat and restart it
The web-app writes a line at the beginning of an action and at the end of an action to a log-file with log4j. So the line at the beginning of the action is written to the log-file, but that's all. I also write the MBs of free memory to the log, i calculate it with the following code
And on the moments that Tomcat is hanging there is plenty of free Memory, so a outofmemory exception can't be the cause. There is also no error thrown, so i am completely out of possibilities and any help is appreciated !
What exactly do you mean by hanging: does it not generate responses anymore? Does it eat up lots of CPU time? Does the process exit? Are there any exceptions in the Tomcat logs (not your application logs)? And since you know from the logfile the action in which it's hanging: what is happening in that action?
Ok, here i am again. Sorry it took so long before i get back, but today the tomcat was hanging again and i have the answers on your questions:
- no errors are written in any log (so not in my application log, not in the tomcat log, nor in the tomcat console window): no errors at all - the cpu time of the server is 0%, so it's not eating up all cpu, but you don't get any response - today i did some brainstorm because it happens in several cases and all these cases have something in common: they go to a database to get some information. so there is something wrong (95% sure about this one)
we use jTDS to go to our ms sql server and we use version 0.9. I downloaded the latest version and will try this one and see what the results are with that one.
when you just restart tomcat the problem is solved and i wonder why it takes about approx a month to get this strange behaviour and it happens each day.
any tips, hints or suggestions are more than welcome thanks anyway
After pointing the problem to the database and database access, i added some debug messages printing out the number of active connections and the maximum of active connections. and after some time the number of active connections equals the maximum, so no connection to the database can be established and tomcat seems hanging.
Cause of the problem: some connections to the database were not closed like it's supposed to be
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com