Originally posted by Deepak Prasanna R:
Thanks a lot Ice
We are not in a position to migrate the Tomcat version.
The first time we click the servlet, am getting the session is not getting recognized. Second time if i click the same servlet, it gets recognized.
If i click any JSP links before the Servlet, then the Servlet is working fine on first click itself.
Can you please suggest a solution based on this.
Thanks & Regards
Deepak
Because you did not supplied enough information, i'll have to make assumptions:
1. You have cookies enabled
2. You have the following problem: Your session is created
before you invoke the problematic servlet to join the pre-exising session. You do that by using HttpServletRequest.getSession(false) - to get only the pre-existing session, not to create a new one. So, if you're using getSession(), try using getSession(false) to detect whether the Container version has a problem with joining a pre-existing session. You'll get NullPointerException if the Container has failed to join the session and you try to use the session.
If you invoke
any JSP it will automatically create a jsp session( by using the default value of the attribute in the page directive), so the next invoked servlet will already has a session to join. Try adding the following attribute session='false' to the page directive in your JSPs, and try invoking the servlet after you have invoked any of those JSPs with this session='false' attribute set. Tell us what you get.
When you're
testing the application, keep track of the cookie : JSESSIONID, to see
which session,
where is created. If you don't now how to do it, you can use IE or Firefox menus to view cookies. That will shed some light about your problem.
In lack of information, I can advice you to try getSession(false) to only join a pre-existing session, keep track of when JSESSIONID cookie is created, and try to solve your problem. If you're still having problems, tell us what kind of errors/issues you got when you tried those things. That will help us greatly to properly diagnose your problem.
By far away, if you're doing things right( like creating and joining session the right way ), it seems a Container issue. Have you checked the docs for your Container version to see whether this what you're describing is a known issue ?
Ice