Web tier: servlets, JSP, Web frameworks: Session Synchronization Problem On Cluster while Using

  1. Hi, I'm facing problem in session synchronization when using iframe in cluster environment. I've parent jsp which has 'iframe' included within it, I've set a bean in session on parent jsp but when trying to access the bean on frame ,am facing 'null' pointer exception...this happens typically when frame jsp and parent jsp gets loaded from different servers..ie., session is not synchronized.. Following is piece of example of code creating problem... ////////////////// 1///////////////////////////// ... .. . parent.jsp .... .. . //////////////////////2////////////////////////// frame.jsp .. ... ///foll. line gives Null pointer Exception when frame.jsp and parent.jsp gets rendered from different tomcat. XYZBean objBean =(XYZBean)session.getAttribute("DATA_BEAN"); objBean.getName();//the objBean is Null!! %> Following is configuration and server.xml entries I'm using.... Tomcat 1: apache-tomcat-5.5.20 ...say lb0 Tomcat 2: apache-tomcat-5.5.20 ....say lb1 Apache Load Balancer -Version 2.0 //////////////////////server.xml/////////////////// <!-- <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer" tempDir="/tmp/war-temp/" deployDir="/tmp/war-deploy/" watchDir="/tmp/war-listen/" watchEnabled="false"/> --> /////////////////////////////////////////////////////////// I've tried following but was unsuccessful in achieving the goal..
    replicationMode="synchronous" as well as "pooled" tried to load the frame after parent.jsp is rendered ..ie. using javascript:onLoad function to ensure that frame.jsp is not rendered before response is committed on parent.jsp Have tried response filter where am putting and removing dummy attribute from session to ensure that session status is changed when invoking any request or action.
    ...Pls suggest the solution for the above problem.. Thanks a ton in advance.. best regards, -Nirav
  2. Definitely a design issue. Even if you try to use sticky sessions there is no safe haven. The only suggestion could be do not assume data is present in session do the defacto back end processing in frame or parent to get your content. Check it may not be aplicable in your scenario.
  3. Use Coherence*Web for your session management and it will solve this problem, because it supports concurrent session access by implementing explicit concurrency control behind the scenes, with synchronous replication. Peace, Cameron Purdy Tangosol Coherence: The Java Data Grid