0 Replies Latest reply on Dec 16, 2013 7:22 AM by Sheng Wang -Oracle

    Coherence*Web does not work

    Sheng Wang -Oracle

      I want to verify use coherence to share session between applications run on weblogics that run on different domain.



      OS Windows 7 64-bit

      WebLogic 10.3.5

      Java Hot Spot 1.6.0_27-b07



      1.Install 2 weblogic 10.3.5

      2.Configure 1 domain for each weblogic, named coh1_domain, coh2_domain, the admin server port is 7001 and 5001.

      3.Deploy <Coherence_home>\lib\coherence-web-spi.war to coh1_domain and coh2_domain

      4.Create a new Web project

      5.Create a new jsp file index.jsp. It get a attribute "COUNT" and then increase 1 and then display this count on page. the content as following

      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%>


          <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">



          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

          <title>Coherence Web Session App 1</title>


          <body >


         String thisServerAddr = request.getLocalAddr();
         int thisServerPort = request.getLocalPort();


         Integer count = (Integer)session.getAttribute("COUNT");
         if (count == null)
         count = new Integer(0);
         count = new Integer(count.intValue() + 1);
         session.setAttribute("COUNT", count);


          <P> Access count: <%=count.intValue()%> </P>

          <P> Server Addr:Port: <%=thisServerAddr%>:<%=thisServerPort%> </P>



      6.Add the above "library-ref" content to weblogic.xml of web project

          <?xml version="1.0" encoding="UTF-8"?>

          <wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.2/weblogic-web-app.xsd">









      7.package project to CoherenceWebSessionTest1.war

      8.Run a stardalone coherence server

      java -server -Xms512m -Xmx512m -cp <Coherence installation dir>//lib/coherence-web.jar;<Coherence installation dir>/lib/coherence.jar -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.cacheconfig=session-cache-config.xml -Dtangosol.coherence.session.localstorage=true com.tangosol.net.DefaultCacheServer

      9.Put <Coherence_home>\lib\coherence.jar to $MW_HOME\user_projects\domains\coh1_domain\lib and restart Start weblogic server of coh1_domain

      10.Put <Coherence_home>\lib\coherence.jar to $MW_HOME\user_projects\domains\coh2_domain\lib and restart Start weblogic server of coh2_domain

      11.Deploy CoherenceWebSessionTest1.war to coh1_domain

      12.Deploy CoherenceWebSessionTest1.war to coh2_domain

      13.Open a web browser(like IE), access index.jsp of coh1_domain and refresh several times, and then open another tab page on browse, and access index.jsp of coh2_domain, we can not see share session taken effect.


      When I access another index.jsp, the session data will clean. why? Any step wrong or some error happen?