If this problem happens every time then I would use the debugger and set a break point on session creation to see what's happening.
When that's not the case, when it happens intermittently then I sometimes resort to something like this. I override the session constructor and log when the session is created, it's sessionId and the stackTrace so I can see exactly how the session is being created. This has been very enlightening over the years. I hope it helps:
public Session() {
super();
String message = "Session created (sessionID:" + sessionID() + ")";
NSLog.err.appendln(message);
new Exception(message).printStackTrace();
}
When a session is created in response to a component action, the output will look something like this:
[2005-06-20 08:25:00 EDT] <WorkerThread0> Session created (sessionID:AVSmK1ZBBYLDgt2uI3GbYw)
java.lang.Exception: Session created (sessionID:AVSmK1ZBBYLDgt2uI3GbYw)
at Session.<init>(Session.java:18)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at java.lang.Class.newInstance0(Class.java:308)
at java.lang.Class.newInstance(Class.java:261)
at com.webobjects.foundation._NSUtilities.instantiateObject(_NSUtilities.java:577)
at com.webobjects.appserver.WOApplication.createSessionForRequest(WOApplication.java:1611)
at com.webobjects.appserver.WOApplication._initializeSessionInContext(WOApplication.java:1752)
at com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWithPreparedApplication(WOComponentRequestHandler.java:309)
at com.webobjects.appserver._private.WOComponentRequestHandler._handleRequest(WOComponentRequestHandler.java:358)
at com.webobjects.appserver._private.WOComponentRequestHandler.handleRequest(WOComponentRequestHandler.java:432)
at com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.java:1306)
at com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.java:173)
at com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java:254)
at java.lang.Thread.run(Thread.java:552)
Good Luck!
Mark.
__
Mark Ritchie
Diamond Lake Consulting Inc.
Toronto, Ontario, Canada