Question

I have one application WAR. I have created two profiles AppSrv01, AppSrv02 on Websphere 8.0.0.0.

My application is having MQ connectivity, J2ee application on struts 1.1.

I have deployed WAR on both the server AppSrv01 as a context A and AppSrv02 as a context B.

I have session listener in my application which will take note of total available session.

The scenario is as given below....

Going and login to url localhost:9082/A, go to some page in it.

Going and login to url localhost:9082/B, go to some page in it in another tab of same browser.

Going to url localhost:9082/A, clicking on some of link or url from the existing page.

on remote debug from server when it come to SessionListener ... it shows below given stack

Daemon Thread [WebContainer : 10] (Suspended (breakpoint at line 24 in SessionCounterListener)) 
SessionCounterListener.sessionCreated(HttpSessionEvent) line: 24    
WasHttpSessionObserver(HttpSessionObserver).sessionCreated(ISession) line: 111  
SessionEventDispatcher.sessionCreated(ISession) line: 98    
SessionManager.createISession(String, int, boolean) line: 268   
SessionManager.createSession(ServletRequest, ServletResponse, SessionAffinityContext, boolean) line: 640    
WsSessionContext(SessionContext).getIHttpSession(HttpServletRequest, HttpServletResponse, boolean, boolean) line: 485   
WsSessionContext(SessionContext).getIHttpSession(HttpServletRequest, HttpServletResponse, boolean) line: 419    
SRTRequestContext.getSession(boolean, WebApp) line: 104 
SRTServletRequest.getSession(boolean) line: 2099    
SRTServletRequest.getSession() line: 2083   
RequestProcessor.processLocale(HttpServletRequest, HttpServletResponse) line: 631   
RequestProcessor.process(HttpServletRequest, HttpServletResponse) line: 230 
ActionServlet.process(HttpServletRequest, HttpServletResponse) line: 1482   
ActionServlet.doPost(HttpServletRequest, HttpServletResponse) line: 525 
ActionServlet(HttpServlet).service(HttpServletRequest, HttpServletResponse) line: 595   
ActionServlet(HttpServlet).service(ServletRequest, ServletResponse) line: 668   
ServletWrapperImpl(ServletWrapper).service(ServletRequest, ServletResponse, WebAppServletInvocationEvent) line: 1147    
ServletWrapperImpl(ServletWrapper).handleRequest(ServletRequest, ServletResponse, WebAppDispatcherContext) line: 722    
ServletWrapperImpl(ServletWrapper).handleRequest(ServletRequest, ServletResponse) line: 449 
ServletWrapperImpl.handleRequest(ServletRequest, ServletResponse) line: 178 
WebAppFilterManagerImpl(WebAppFilterManager).invokeFilters(ServletRequest, ServletResponse, IServletContext, RequestProcessor, EnumSet<CollaboratorInvocationEnum>) line: 1020  
CacheServletWrapper.handleRequest(ServletRequest, ServletResponse) line: 87 
WSWebContainer(WebContainer).handleRequest(IRequest, IResponse) line: 883   
WSWebContainer.handleRequest(IRequest, IResponse) line: 1659    
WCChannelLink.ready(VirtualConnection) line: 195    
HttpInboundLink.handleDiscrimination() line: 452    
HttpInboundLink.handleNewRequest() line: 511    
HttpInboundLink.processRequest() line: 305  
HttpInboundLink.ready(VirtualConnection) line: 276  
NewConnectionInitialReadCallback.sendToDiscriminators(VirtualConnection, TCPReadRequestContext, boolean) line: 214  
NewConnectionInitialReadCallback.complete(VirtualConnection, TCPReadRequestContext) line: 113   
AioReadCompletionListener.futureCompleted(IAbstractAsyncFuture, Object) line: 165   
AsyncFuture(AbstractAsyncFuture).invokeCallback(ICompletionListener, AbstractAsyncFuture, Object) line: 217 
AsyncFuture(AsyncChannelFuture).fireCompletionActions() line: 161   
AsyncFuture.completed(long) line: 138   
ResultHandler.complete(AsyncFuture, int, int) line: 204 
ResultHandler.runEventProcessingLoop(boolean) line: 775 
ResultHandler$2.run() line: 905 
ThreadPool$Worker.run() line: 1648  

It is creating another session instance. need to understand why it is creating another instance.

Was it helpful?

Solution

When you open the tabs in IE, for IE its same session. So you will have only one cookie JSESSIONID per domain.

when you go to localhost:9082/A - you have JSESSIONID like SESSIONID-A.

when you go to localhost:9082/B - you have JSESSIONID like SESSIONID-B.

So when you access application on AppSrv01, JSESSIONID goes to AppSrv01 is SESSIONID-B. Appserver doesn't know about this session id, so it thinks its a new user and creates a session.

Try opening a IE-> File -> New Session and access the application on AppSrv02 you won't face the above issue.

If you have something like IEWATCH or Fidler, you will be able to see the JSESSIONID going from client/browser.

OTHER TIPS

There's also a setting HttpSessionIdReuse that might help with this as well. I know it works for multiple Servers in the same Cell, but I'm not sure whether it works across Profiles.

http://www-01.ibm.com/support/docview.wss?uid=swg21210881

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top