On 28.07.2010 01:01, Robinson, Eric wrote:
2) Use System.getRuntime().addShutdownHook() to trigger your
own thread when the JVM does decide to exit.

Assuming the OP does not have easy access to the running
application, would that mean adding another application
which is launched at Tomcat start, and runs the above ?
Or do you need to do this in the application itself ?

That was my next question, too.

Sorry I don't remember the whole long discussion thread.

So we definiteley know the process is gone and not that it is only no longer responding?

Do we know whether it was an orderly Tomcat shutdown or not? Log messages in the Tomcat log files?

Assuming it was not: do we know it was an orderly JVM shutdown. Here we could use the shutdown hook. You can

- deploy another webapp (needs write access to Tomcat config or deployment area depending on config)

- change the existing webapp (i.e. adding a context listner that registers the hook during startup; don't need to change existing webapp classes)

- add a JSP which registers the hook when called (only needs write access to some content directory on the existing webapp)

- Download TC source and add it there (if you can't change anything in the webapp or config directories, but can write to the Tomcat classes or lib directories.

Or: do you see any hotspot error files, which should be there if the JVM crashes and can write to the working directory.If you had a newer JVM (recent 1.5 or 1.6) you could add the flag -XX:OnError=... to run a command at the moment it crashes.

Concerning special requests which might trigger functionality leading to a crash: You could add a filter to the webapp doing a simplified access log in front of request processing and then check after crsh, which of those were missing in the final access log. To make matching easir, the filter could add a request attribute with a unique ID to each request and log it, and you can configure your normal access log pattern to also include this attribute. So you only have to compare the two ID lists to find the reuests, that entered Tomcat but were not finished when it crashed.

Regards,

Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to