Link to home
Start Free TrialLog in
Avatar of ragtan
ragtan

asked on

jsp session handling

hello,
    I having lot of trouble login in at the same time. here is the scenario.
    When I login here is the flow of events
    Jsp---> sends commend to servlet --> calls Business Objects --> calls DAO's --> talks to the SSO and the local database for authentication..
   This is an J2EE application residing under ATG Dynamo server. But we are not using any of the ATG session handling.. We have our own session handling classes defined to manage sessions.
   Here is the problem.. Basically I noticed two problems.
 1)  When two Users tried to login at the same time. Only one user will able to login and the second user was shown the blank page with the message

java.lang.IllegalStateException: Redirect not allowed; response is already committed.
        at atg.servlet.DynamoHttpServletResponse.sendRedirect(DynamoHttpServletResponse.java:943)
        at com.attws.mms.TSDSecurity.controller.BaseController.dispatch(BaseController.java:397)
        at com.attws.mms.TSDSecurity.controller.BaseController.doPost(BaseController.java:502)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                                                                 at com.attws.mms.TSDSecurity.controller.BaseController.service(BaseController.java:417)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                                                                 at atg.servlet.container.WebApplication.dispatchServlet(WebApplication.java:1188)
        at atg.servlet.container.WebApplication.dispatchServlet(WebApplication.java:1035)
        at atg.servlet.container.FilterChainImpl.dispatchServlet(FilterChainImpl.java:320)
        at atg.servlet.container.NullFilterChain.doFilter(NullFilterChain.java:116)
        at atg.servlet.container.FilterChainImpl.execute(FilterChainImpl.java:219)
        at atg.servlet.container.WebApplication.dispatchServlet(WebApplication.java:1007)
        at atg.servlet.container.WebApplication.dispatchRequest(WebApplication.java:642)
        at atg.servlet.container.WebApplication.dispatchRequest(WebApplication.java:503)
        at atg.servlet.pipeline.WebApplicationDispatcherPipelineServlet.service(WebApplicationDispatcherPipelineServlet.java:66)
                                                                                                                          at atg.servlet.pipeline.PipelineableServletImpl.
passRequest(PipelineableServletImpl.java:115)
        at atg.servlet.security.ThreadUserBinderServlet.service(ThreadUserBinderServlet.java:90)
        at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:115)
        at atg.servlet.security.FormLoginPipelineServlet.service(FormLoginPipelineServlet.java:156)
        at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:115)
        at atg.userprofiling.AccessControlServlet.service(AccessControlServlet.java:558)
        at atg.servlet.pipeline.PipelineableServletImpl.passRequest(PipelineableServletImpl.java:115)
        at atg.userprofiling.PageEventTriggerPipelineServlet.service(PageEventTriggerPipelineServlet.java:168)

When you refresh the page you will be able to see the page comming

  2) We logged in as different users at the same time. A blank page with the above message comes up and then when I refresh for my wonder both of us are getting the same user info.. This does not happen always.. But still this happend couple of times. I know for sure this could be something to do with session handling. But I dont have any control on sessionManager class files.I dont know What I can do to handle this happening. Is there anything that I can try from JSP page like making sure we always have a unique session throughout the session? I'm using redirect everywhere... Please let me know if you need more information

Please help me out with the solution.
ASKER CERTIFIED SOLUTION
Avatar of vzilka
vzilka

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of anthony_castillon
anthony_castillon

On no. 1, the exception will occur if the response has already be flushed/sent prior to calling the sendRedirect().  If the session handling classes were done correctly, different threads should have been created to handle various sessions.  There shouldn't be any session issues there.  The problem then may be in your session handling mechanism.  Why not just use the built-in session handling mechanism of your server?  That's what these tools are for, so that you can do away with such tasks and instead concentrate with building your application.
can we have a loot at this servlet in full: BaseController.java:397?
Avatar of Mayank S
Does your Servlet, by any chance, implement the SingleThreadModel?