You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jochen Schneider <jo...@decrc.abb.de> on 2000/11/16 10:20:16 UTC

Tomcat 3.2-b7 not compliant to Servlet Specification 2.2 ?!

Hi,

I posted the attached error description a few weeks ago but didn't get any response. Yesterday I tried tomcat 3.2-b7 and the error seems to be still in there. 

It seems that tomcat does not remove all previously added contexts if it is shutdown. This is a major problem because if the context is not properly removed the destroy method of the servlets is not called, which is guaranteed by the serlvet specification. Therefor 3.2 does not comply with JSDK 2.2. 

I have put some log messages in the destroy method of my servlets, but this method is never called if I shutdown tomcat using the shutdown.bat command script. 

This behaviour can be reproduced with the three web apps coming with tomcat: (example, admin, test). If tomcat (3.2-b7)  is started from a command prompt ( tomcat.bat run)  the following output is produced (Test environment : JDK 1.2.2, Win NT 4.0 SP5, Tomcat 3.2-b7):

[e:\temp\tomcat-3.2-b7\bin]tomcat.bat run
Including all jars in e:\temp\tomcat-3.2-b7\lib in your CLASSPATH.

Using CLASSPATH: e:\temp\tomcat-3.2-b7\classes;e:\temp\tomcat-3.2-b7\lib\ant.jar
;e:\temp\tomcat-3.2-b7\lib\jasper.jar;e:\temp\tomcat-3.2-b7\lib\jaxp.jar;e:\temp
\tomcat-3.2-b7\lib\parser.jar;e:\temp\tomcat-3.2-b7\lib\servlet.jar;e:\temp\tomc
at-3.2-b7\lib\webserver.jar

2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /examples )
2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2000-11-15 05:09:23 - ContextManager: Adding context Ctx(  )
2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /test )
2000-11-15 05:09:23 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
2000-11-15 05:09:23 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007


All contexts were added properly!

If I shutdown tomcat using the stop script (shutdown.bat) from another command prompt the following output is produced : 


2000-11-15 05:09:27 - ContextManager: Removing context Ctx( /examples )
2000-11-15 05:09:27 - ContextManager: Removing context Ctx(  )


As you can see only the /example and the root context was removed. The real strange thing is that the output varies! Here is the output of a second try with exact the same environment!

[e:\temp\tomcat-3.2-b7\bin]tomcat.bat run
Including all jars in e:\temp\tomcat-3.2-b7\lib in your CLASSPATH.

Using CLASSPATH: e:\temp\tomcat-3.2-b7\classes;e:\temp\tomcat-3.2-b7\lib\ant.jar
;e:\temp\tomcat-3.2-b7\lib\jasper.jar;e:\temp\tomcat-3.2-b7\lib\jaxp.jar;e:\temp
\tomcat-3.2-b7\lib\parser.jar;e:\temp\tomcat-3.2-b7\lib\servlet.jar;e:\temp\tomc
at-3.2-b7\lib\webserver.jar

2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /examples )
2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2000-11-15 05:09:34 - ContextManager: Adding context Ctx(  )
2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /test )
2000-11-15 05:09:35 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
2000-11-15 05:09:35 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007

2000-11-15 05:09:37 - ContextManager: Removing context Ctx( /examples )



Now only the example context was removed by the ContextManager.


This behavior is a major problem for us since we rely on the destroy method of the servlet to release some handles in a remote object. I tried a lot of things but didn't succeed. 


I really would appreciate any help or comment.

--Jochen 



Re: Tomcat 3.2-b7 not compliant to Servlet Specification 2.2 ?!

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Thanks for the patch Marc!  I'm sorry I missed this when fixing things for b7.
It will be fixed in the final release.

Craig McClanahan


Marc Saegesser wrote:

> I posted a patch a few days ago to fix this problem.  In most cases Tomcat
> shutsdown every other context starting with the first one added so you might
> be able to adjust the order of the contexts in your server.xml file to make
> sure that it hits the ones you really need shutdown.
>
> If you can build from source, please try the attached patch and see if it
> fixes the problem for you.
>
> Marc Saegesser
>
> -----Original Message-----
> From: Jochen Schneider [mailto:jochen.schneider@decrc.abb.de]
> Sent: Thursday, November 16, 2000 3:20 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Tomcat 3.2-b7 not compliant to Servlet Specification 2.2 ?!
>
> Hi,
>
> I posted the attached error description a few weeks ago but didn't get any
> response. Yesterday I tried tomcat 3.2-b7 and the error seems to be still in
> there.
>
> It seems that tomcat does not remove all previously added contexts if it is
> shutdown. This is a major problem because if the context is not properly
> removed the destroy method of the servlets is not called, which is
> guaranteed by the serlvet specification. Therefor 3.2 does not comply with
> JSDK 2.2.
>
> I have put some log messages in the destroy method of my servlets, but this
> method is never called if I shutdown tomcat using the shutdown.bat command
> script.
>
> This behaviour can be reproduced with the three web apps coming with tomcat:
> (example, admin, test). If tomcat (3.2-b7)  is started from a command prompt
> ( tomcat.bat run)  the following output is produced (Test environment : JDK
> 1.2.2, Win NT 4.0 SP5, Tomcat 3.2-b7):
>
> [e:\temp\tomcat-3.2-b7\bin]tomcat.bat run
> Including all jars in e:\temp\tomcat-3.2-b7\lib in your CLASSPATH.
>
> Using CLASSPATH:
> e:\temp\tomcat-3.2-b7\classes;e:\temp\tomcat-3.2-b7\lib\ant.jar
> ;e:\temp\tomcat-3.2-b7\lib\jasper.jar;e:\temp\tomcat-3.2-b7\lib\jaxp.jar;e:\
> temp
> \tomcat-3.2-b7\lib\parser.jar;e:\temp\tomcat-3.2-b7\lib\servlet.jar;e:\temp\
> tomc
> at-3.2-b7\lib\webserver.jar
>
> 2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /examples )
> 2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /admin )
> Starting tomcat. Check logs/tomcat.log for error messages
> 2000-11-15 05:09:23 - ContextManager: Adding context Ctx(  )
> 2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /test )
> 2000-11-15 05:09:23 - PoolTcpConnector: Starting HttpConnectionHandler on
> 8080
> 2000-11-15 05:09:23 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
> 8007
>
> All contexts were added properly!
>
> If I shutdown tomcat using the stop script (shutdown.bat) from another
> command prompt the following output is produced :
>
> 2000-11-15 05:09:27 - ContextManager: Removing context Ctx( /examples )
> 2000-11-15 05:09:27 - ContextManager: Removing context Ctx(  )
>
> As you can see only the /example and the root context was removed. The real
> strange thing is that the output varies! Here is the output of a second try
> with exact the same environment!
>
> [e:\temp\tomcat-3.2-b7\bin]tomcat.bat run
> Including all jars in e:\temp\tomcat-3.2-b7\lib in your CLASSPATH.
>
> Using CLASSPATH:
> e:\temp\tomcat-3.2-b7\classes;e:\temp\tomcat-3.2-b7\lib\ant.jar
> ;e:\temp\tomcat-3.2-b7\lib\jasper.jar;e:\temp\tomcat-3.2-b7\lib\jaxp.jar;e:\
> temp
> \tomcat-3.2-b7\lib\parser.jar;e:\temp\tomcat-3.2-b7\lib\servlet.jar;e:\temp\
> tomc
> at-3.2-b7\lib\webserver.jar
>
> 2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /examples )
> 2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /admin )
> Starting tomcat. Check logs/tomcat.log for error messages
> 2000-11-15 05:09:34 - ContextManager: Adding context Ctx(  )
> 2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /test )
> 2000-11-15 05:09:35 - PoolTcpConnector: Starting HttpConnectionHandler on
> 8080
> 2000-11-15 05:09:35 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
> 8007
>
> 2000-11-15 05:09:37 - ContextManager: Removing context Ctx( /examples )
>
> Now only the example context was removed by the ContextManager.
>
> This behavior is a major problem for us since we rely on the destroy method
> of the servlet to release some handles in a remote object. I tried a lot of
> things but didn't succeed.
>
> I really would appreciate any help or comment.
>
> --Jochen
>
>   ------------------------------------------------------------------------
>                            Name: ContextManager.patch
>    ContextManager.patch    Type: unspecified type (application/octet-stream)
>                        Encoding: quoted-printable


RE: Tomcat 3.2-b7 not compliant to Servlet Specification 2.2 ?!

Posted by Marc Saegesser <ma...@apropos.com>.
I posted a patch a few days ago to fix this problem.  In most cases Tomcat
shutsdown every other context starting with the first one added so you might
be able to adjust the order of the contexts in your server.xml file to make
sure that it hits the ones you really need shutdown.

If you can build from source, please try the attached patch and see if it
fixes the problem for you.

Marc Saegesser


-----Original Message-----
From: Jochen Schneider [mailto:jochen.schneider@decrc.abb.de]
Sent: Thursday, November 16, 2000 3:20 AM
To: tomcat-user@jakarta.apache.org
Subject: Tomcat 3.2-b7 not compliant to Servlet Specification 2.2 ?!


Hi,

I posted the attached error description a few weeks ago but didn't get any
response. Yesterday I tried tomcat 3.2-b7 and the error seems to be still in
there.

It seems that tomcat does not remove all previously added contexts if it is
shutdown. This is a major problem because if the context is not properly
removed the destroy method of the servlets is not called, which is
guaranteed by the serlvet specification. Therefor 3.2 does not comply with
JSDK 2.2.

I have put some log messages in the destroy method of my servlets, but this
method is never called if I shutdown tomcat using the shutdown.bat command
script.

This behaviour can be reproduced with the three web apps coming with tomcat:
(example, admin, test). If tomcat (3.2-b7)  is started from a command prompt
( tomcat.bat run)  the following output is produced (Test environment : JDK
1.2.2, Win NT 4.0 SP5, Tomcat 3.2-b7):

[e:\temp\tomcat-3.2-b7\bin]tomcat.bat run
Including all jars in e:\temp\tomcat-3.2-b7\lib in your CLASSPATH.

Using CLASSPATH:
e:\temp\tomcat-3.2-b7\classes;e:\temp\tomcat-3.2-b7\lib\ant.jar
;e:\temp\tomcat-3.2-b7\lib\jasper.jar;e:\temp\tomcat-3.2-b7\lib\jaxp.jar;e:\
temp
\tomcat-3.2-b7\lib\parser.jar;e:\temp\tomcat-3.2-b7\lib\servlet.jar;e:\temp\
tomc
at-3.2-b7\lib\webserver.jar

2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /examples )
2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2000-11-15 05:09:23 - ContextManager: Adding context Ctx(  )
2000-11-15 05:09:23 - ContextManager: Adding context Ctx( /test )
2000-11-15 05:09:23 - PoolTcpConnector: Starting HttpConnectionHandler on
8080
2000-11-15 05:09:23 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
8007


All contexts were added properly!

If I shutdown tomcat using the stop script (shutdown.bat) from another
command prompt the following output is produced :


2000-11-15 05:09:27 - ContextManager: Removing context Ctx( /examples )
2000-11-15 05:09:27 - ContextManager: Removing context Ctx(  )


As you can see only the /example and the root context was removed. The real
strange thing is that the output varies! Here is the output of a second try
with exact the same environment!

[e:\temp\tomcat-3.2-b7\bin]tomcat.bat run
Including all jars in e:\temp\tomcat-3.2-b7\lib in your CLASSPATH.

Using CLASSPATH:
e:\temp\tomcat-3.2-b7\classes;e:\temp\tomcat-3.2-b7\lib\ant.jar
;e:\temp\tomcat-3.2-b7\lib\jasper.jar;e:\temp\tomcat-3.2-b7\lib\jaxp.jar;e:\
temp
\tomcat-3.2-b7\lib\parser.jar;e:\temp\tomcat-3.2-b7\lib\servlet.jar;e:\temp\
tomc
at-3.2-b7\lib\webserver.jar

2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /examples )
2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2000-11-15 05:09:34 - ContextManager: Adding context Ctx(  )
2000-11-15 05:09:34 - ContextManager: Adding context Ctx( /test )
2000-11-15 05:09:35 - PoolTcpConnector: Starting HttpConnectionHandler on
8080
2000-11-15 05:09:35 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
8007

2000-11-15 05:09:37 - ContextManager: Removing context Ctx( /examples )



Now only the example context was removed by the ContextManager.


This behavior is a major problem for us since we rely on the destroy method
of the servlet to release some handles in a remote object. I tried a lot of
things but didn't succeed.


I really would appreciate any help or comment.

--Jochen