I've got a Tomcat installed like a Home windows service, and often it dangles after i attempt to shut it lower (through services.msc). I attempted affixing into it having a debugger, however i don't appear to have the ability to realise why it's hanging.

After I try to check out among the threads by doing "Thread.getThreads()[]", I recieve a mistake in the debugger: "Stack frame not available".

If rather than shutting lower the whole Tomcat, I simply unload my servlets' contexts, everything works perfectly.

How does one proceed in debugging this? Is by-definition a bug in Tomcat?

I do not believe it is a bug in tomcat, since my tomcats are shut lower ok.

Should you state that whenever you unload all of the web applications things are ok, maybe the issue is and among the net applications. Attempt to unload just individually. shut lower the tomcat and find out what goes on. if it's an internet application that triggers the issue, when you unload it you will not possess the problem.

Yet another question - what happen when you're doing so in the command line (not in the services screen)?


To be able to debug remotely you have to add the next towards the JAVA_Decides

JAVA_OPTS=%JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

You'll be able to attach an IDE like eclipse towards the process (search for remote debugging). You are able to download the origin from here. What you're searching for (I suppose) is techniques applying Lifecycle.stop() or implementations of LifecycleListener. Sorry I am unable to become more specific.

Edit 2

Yet another factor - if it's your development machine, I discovered it better to run eclipse less something but in the command line or from the IDE

For completeness sake, I have to request: perhaps you have checked Tomcat's own log files?


that is most likely something similar to...

C:\Program Files\Apache Software Foundation\Tomcat 6.0\logs

Please forgive me if this sounds like the very first factor you attempted, but you didn't bring it up, and so i figured I'd request just to be certain.

One factor you could attempt doing is applying a profiler to determine what objects remain in memory following a shutdown.

I went right into a similar problem where my codebase were built with a 'logical memory leak.' The wordage must be carefully selected because java garbage collection does prevent most memory leaks. Logical memory leaks are produced by developers that aren't as careful as they must be, or they are under an excessive amount of a period crunch.

Anyway, we used JProfile to determine what objects remained as alive within the virtual machine, and that we discovered that some threads weren't correctly taken proper care of throughout a shutdown. If you can to discover what objects continue to be alive, you'll have a hint why tomcat isn't completely shutting lower.