tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bodycombe, Andrew" <>
Subject RE: Weird Problems
Date Tue, 10 Feb 2004 16:18:38 GMT
I think the problem with your listener is that you assume the number of
active sessions will be 0 when the server starts up. Tomcat may persist
(passivate) sessions when the server is shut down. These sessions will be
re-activated the next time the server starts up.

If you reduce your session counter in the sessionWillPassivate() method and
increase the session counter in the sessionDidActivate() method, that may
get around your problem.

I think your 404 problem needs further investigation. 7-8% seems a very high
error rate.


-----Original Message-----
From: Vernon Wu [] 
Sent: 10 February 2004 16:10
To: Tomcat Users List
Subject: RE: Weird Problems

Thanks Yoav for your response. 

>>The first problem is the session counter. It is implemented with the
>>HttpSessionListener. It works fine until recently. Under the TC5.0.X,
>>counter can be a negative figure.
>The problem is obviously in your session counter code: if you posted it,
>we could help more.

I wish I can say the same. It, however, doesn' explain why the problem only
occurs recently. I note it on TC 5.0.x with the same code (I believe). Here
is the code segment:

public final class MyListener
		HttpSessionActivationListener {

	private static int activeSessionCount = 0;

	public void contextInitialized(ServletContextEvent evt) {

// ...

	public void contextDestroyed(ServletContextEvent evt) {

// ...

	public void sessionCreated(HttpSessionEvent evt) {

		HttpSession session = evt.getSession();
// ...
			"The session ID: "
				+ session.getId()
				+ ", the total # of active sessions: "
				+ activeSessionCount);

	public void sessionDestroyed(HttpSessionEvent evt) {

		logger.debug("The number of active sessions: " +

	public void sessionWillPassivate(HttpSessionEvent evt) {
// ...

	public void sessionDidActivate(HttpSessionEvent evt) {"sessionDidActivate");

	public static int getActiveSessionCount() {
		return activeSessionCount;

>>The second is a quite severe problem. I configure the welcome file to
>map a
>>JSP file. Sometimes, an incoming URL of the default domain leads to the
>>error. After I click the reload button on my browser, the JSP file
>You need to do better than "sometimes" in order to get precise help.
>When does it happen, when does it not happen, and what's in the logs in
>both cases?

If I could pin point the occasion, I might solve it by now. I don't observe
any logs from the container during the time when the error occurs, but I
would like to know how set up logging messages for the problem. I don't know
whether it is related with the container configuration. The tag pool is

Also, some users report the 404 error on some other use scenario, but we
haven't observe the same. The error rate is above 7-8% of the total hits. If
a user follows the action options on a screen, the error shall never happen.


Find what you are looking for with the Lycos Yellow Pages

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message