tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sherman Mohler <>
Subject Re: Why tomcat NT service get killed when the user log off
Date Sun, 19 Nov 2000 15:21:00 GMT
You say this is a problem with Java 1.3. Will Java 1.2 work correctly ? I am
about to install and start testing TomCat, and was about to use 1.3 ...


-- Sherman Mohler

Nacho wrote:

> Brett can you contributeyour solution to this problem tojakarta??
> or at least send me thesources or binaries :-) is the better  more
> elegant solution to this problem i've seen,
> if you can contribute this i'll be glad to commit it to tomcat 3.3 and
> 4.0
> of course giving you credits as the rules mandate ;-)
> Saludos ,
> Ignacio J. Ortega
> -----Mensaje original-----
> De: Brett Bergquist []
> Enviado el: jueves 16 de noviembre de 2000 1:01
> Para:
> Asunto: RE: Why tomcat NT service get killed when the user log off
> Zhiping, even though jk_nt_service is being used to launch Tomcat, there
> is a bug in the Java 1.3 runtime under Windows that causes any java.exe
> process to be terminated when the user logs off. The bug is that a
> console control handler is setup inside of the java runtime that detects
> the CTRL_LOGOFF_EVENT that is sent by Windows to each process when the
> user logs off and the handler inside of Java 1.3 is terminating the
> process when this occurs. This is the correct operation for a normal
> application running but not the correct one for a service.
> There is a couple of packages around, one being located at
> another at
> that handle the CTRL_LOGOFF_EVENT. I tried
> a couple of these and while I found that they indeed to stop the
> application from being terminated by the CTRL_LOGOFF_EVENT, I found that
> they interferred with the normal shutdown of Tomcat. That is, using
> these packages, I was not able to shutdown Tomcat cleanly, which caused
> the servlets to not have their "destroy" method invoked.
> The reason that this occurs is because the way that these packages work
> is that they invoke the Java VM using the JNI interface. When Tomcat is
> to be shutdown, the same JNI interface is used to invoke a shutdown
> method. The problem occurs because the way that Tomcat (3.x) is shutdown
> is by using the APJ interface to send the existing Tomcat instance a APJ
> shutdown message (through a TCP connection in fact). These packages send
> the APJ message using the JNI interface, but when call returns, they
> assume that Tomcat is ready to be shutdown and they then tear down the
> Java VM running the Tomcat process. In reality, the Tomcat process has
> not yet received the APJ message through its socket interface and as
> such has not shutdown cleanly and does not give the servlets a chance to
> have their "destroy" method called.
> Because my application needs to have the servlet's "destroy" method
> called when Tomcat shuts down, I solved this problem by using the source
> to "java.exe" launcher as a starting point and then modified it to
> install a console control handler that ignores the CTRL_LOGOFF_EVENT. I
> called this new launcher "javaex.exe". I then used jk_nt_service and
> changed the configuration file references of "java.exe" to "javaex.exe".
> I hope this helps.
> -----Original Message-----
> From: Zhiping Wei []
> Sent: Wednesday, November 15, 2000 5:38 PM
> To: ''
> Subject: Why tomcat NT service get killed when the user log off
> Please Help!!!
> This is for tomcat 3.2 beta 7 on Windows NT/2000. Tomcat is registed as
> an NT service using 'jk_nt_service.exe' (under Systemlocal account).
> It's starts fine but if I log off the windows, tomcat get killed which
> is not suppose to be. Could anybody tell me why this happen and how to
> fix it.
> -- Zhiping (ext: 307)

View raw message