| Author |
Losing sessions...
|
Dave Jochim
Ranch Hand
Joined: Jan 08, 2003
Posts: 31
|
|
I have an application that I have been running under Tomcat 4.0.6. In some JSPs I have regular HTML anchor tags which call servlets in another part of the application < a href="ServletName?oper=add"... In Tomcat 4.0.6 these links work fine and the session persists with these calls. When I tried the application on a newer version of Tomcat 4.1.24 or 5.0.12 I 'lose'(for lack of a better term) the session when I use this link. I was just curious about this change, if it was a problem with 4.0.6 or the newer versions, and why. Or, have I missed something in my web.xml or server.xml? My context in server.xml is pretty much the default, and my web.xml is really just servlets and their mappings. I have left the Session manager with the default settings and also tried the PersistentManager settings, to no avail. Thank you.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11863
|
|
You should not be "losing" sessions if all servlets and JSP are part of the same web application. I don't think that Tomcat changed anything related to this between 4.0.6 and 4.1.24, but you might want to look at the release notes. Bill (mystified)
|
Java Resources at www.wbrogden.com
|
 |
Dave Jochim
Ranch Hand
Joined: Jan 08, 2003
Posts: 31
|
|
Basically what seems to be happening: Start at: ServletA - session1 created Uses the RequestDispatcher forward to go to: ServletB - uses session1 In ServletB there is an exception thrown by my application MyAppException. This is handled by an error page defined in web.xml, Error.jsp - the error page uses session1 Error.jsp has a link <a href="ServletB"> Follow this link... ServletB has no session. So in ServletB the code: creates a new session and leads to a NullPointerException.
|
 |
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11863
|
|
Are either of these servlets addressed using the "invoker" style URL - like /servlet/ServletA I think it is possible to lose track of a sessionID that way. I also wonder if the Error.jsp response is sending the sessionID in the response - since thats the only way the client will get the sessionID. Bill
|
 |
 |
|
|
subject: Losing sessions...
|
|
|