1 2 Previous Next 18 Replies Latest reply: Apr 7, 2011 11:17 PM by Steve Button-Oracle RSS

    HTTP Session sharing across multiple EARs /Applications

    690917
      Hi,

      I am using three different application with a single login

      is it possible to share the session across my 3 applications

      i am using weblogic10.3 and ADF 11 Release 1

      i have created three different applications and deployed to the same server


      Please advice

      Regards
      Jeethi George
        • 1. Re: HTTP Session sharing across multiple EARs /Applications
          Jay SenSharma MiddlewareMagic
          Hi Jeethi,

          This is possible in WebLogic.

          Enabling Web applications to share the same session
          By default, Web applications do not share the same session. If you would like Web applications to share the same session, you can configure the session descriptor at the application level in the weblogic-application.xml deployment descriptor. To enable Web applications to share the same session, set the sharing-enabled attribute in the session descriptor to true in the weblogic-application.xml deployment descriptor. See "sharing-enabled" in session-descriptor.

          The session descriptor configuration that you specify at the application level overrides any session descriptor configuration that you specify at the Web application level for all of the Web applications in the application. If you set the sharing-enabled attribute to true at the Web application level, it will be ignored.

          All Web applications in an application are automatically started using the same session instance if you specify the session descriptor in the weblogic-application.xml deployment descriptor and set the sharing-enabled attribute to true as in the following example: *"sharing-enabled"*


          <?xml version="1.0" encoding="ISO-8859-1"?>
          <weblogic-application xmlns="http://www.bea.com/ns/weblogic/90";;>
          <session-descriptor>
               <persistent-store-type>memory</persistent-store-type>
          <sharing-enabled>true</sharing-enabled>
          </session-descriptor>
          </weblogic-application>


          Thanks
          Jay SenSharma
          http://jaysensharma.wordpress.com/generalweblogic/ (WebLogic Wonders Are Here)

          Edited by: Jay SenSharma on Jan 11, 2010 5:56 PM
          • 2. Re: HTTP Session sharing across multiple EARs /Applications
            690917
            Hi Jay

            i tried by creating two application and seems its not working for me , any mopre config need in web,\.xml
            in both application i hve add the weblogic-application.xml


            as u advised i have updated weblogic-application.xml like


            <?xml version = '1.0' encoding = 'windows-1252'?>
            <weblogic-application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-application http://www.bea.com/ns/weblogic/weblogic-application/1.0/weblogic-application.xsd" xmlns="http://www.bea.com/ns/weblogic/weblogic-application">
            <listener>
            <listener-class>oracle.adf.share.weblogic.listeners.ADFApplicationLifecycleListener</listener-class>
            </listener>
            <listener>
            <listener-class>oracle.mds.lcm.weblogic.WLLifecycleListener</listener-class>
            </listener>
            <library-ref>
            <library-name>adf.oracle.domain</library-name>
            <implementation-version>11.1.1.1.0</implementation-version>
            </library-ref>

            *<session-descriptor>*
            *<persistent-store-type>memory</persistent-store-type>*
            *<sharing-enabled>true</sharing-enabled>*
            *</session-descriptor>*

            </weblogic-application>

            Should i share the session attribute in both application ?
            what about the session parameter ( Time out ) config in web.xml  ?


            please advice is there any more cofig needed in web.xml
            • 3. Re: HTTP Session sharing across multiple EARs /Applications
              Faisal Khan
              Yes, there seems to be some issues with the session-sharing feature, it has been reported in other forums.. u can try opening a service ticket..

              Sharing sessions between EARS using Weblogic 9.2 sharing-enabled feature
              • 4. Re: HTTP Session sharing across multiple EARs /Applications
                690917
                Hi Faisal Khan

                i couldnt find anything useful for me , in the thread u specified
                • 5. Re: HTTP Session sharing across multiple EARs /Applications
                  Faisal Khan
                  Hi Jeethi,

                  "I am using three different application with a single login"

                  If you want to share the seesion just for login purpose.. u can consider SAML BASED Single Signon...

                  BTW the other forum talks about the sharing seesion between two EAR's and they tried using sharing-enabled feature which doesnt seem to work for them.

                  I felt it was related, and with a simple reproducer, support would be able to provide some answers.

                  Thanks,
                  Faisal
                  • 6. Re: HTTP Session sharing across multiple EARs /Applications
                    Jay SenSharma MiddlewareMagic
                    Hi,

                    I have tested the application in WLS10.3 ... with one EAR WebAppEar which containe WebApp_A and WebApp_B.

                    ----------------------
                    ----------------------
                    In WebApp_A application i just placed the following "*index.jsp*" page

                    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
                    <%@ page session="false" %>
                    <html>
                    <body>
                    <center><h3>Hi this is <font color=green>WebApp_A</font></h3></center>
                    <%
                    HttpSession session=request.getSession(true);
                    out.println("<h4>Session ID: "+session.getId());
                    session.setAttribute("AAAAAAAAA","BBBBBBBBBBBBBBB: "+new java.util.Date());
                    session.setAttribute("CCCCCCCCC","DDDDDDDDDDDDDDD: "+new java.util.Date());
                    java.util.Vector v=new java.util.Vector();
                    v.add(new java.util.Date());
                    v.add(new java.util.ArrayList());
                    v.add("AAAAABBCCCC");
                    session.setAttribute("EEEEEEEEEEEEEE",v);
                    %>
                    Data is Set As an Attribute inside the HttpSession:
                    session.setAttribute("AAAAAAAAA","BBBBBBBBBBBBBBB: "+new java.util.Date());
                    session.setAttribute("CCCCCCCCC","DDDDDDDDDDDDDDD: "+new java.util.Date());
                    java.util.Vector v=new java.util.Vector();
                    v.add(new java.util.Date());
                    v.add(new java.util.ArrayList());
                    v.add("AAAAABBCCCC");
                    session.setAttribute("EEEEEEEEEEEEEE",v);
                    <%
                    System.out.println("\n\tWebApp_A"+(String)request.getSession().getAttribute("AAAAAAAAA"));
                    System.out.println("\n\tWebApp_A"+(String)session.getAttribute("CCCCCCCCC"));
                    System.out.println("\n\tWebApp_A"+session.getAttribute("EEEEEEEEEEEEEE"));
                    %>
                    <h4>Click here To Access WebApp_B</h4>
                    </body>
                    </html>
                    ----------------------
                    ----------------------
                    In WebApp_B application i just placed the following "*index.jsp*" page

                    <%@ page language="java" contentType="text/html;charset=UTF-8"%>
                    <html>
                    <body>
                    <center><h3>Hi this is <font color=red>WebApp_B</font></h3></center>
                    <%
                    System.out.println("\n\tWebApp_B"+(String)request.getSession().getAttribute("AAAAAAAAA"));
                    System.out.println("\n\tWebApp_B"+(String)session.getAttribute("CCCCCCCCC"));
                    System.out.println("\n\tWebApp_B"+session.getAttribute("EEEEEEEEEEEEEE"));
                    out.println("WebApp_B getAttribute(\"AAAAAAAAA\")<BR>"+(String)request.getSession().getAttribute("AAAAAAAAA"));
                    out.println("WebApp_B getAttribute(\"CCCCCCCCC\")<BR>"+(String)session.getAttribute("CCCCCCCCC"));
                    out.println("WebApp_B getAttribute(\"EEEEEEEEEEEEEE\")<BR>"+session.getAttribute("EEEEEEEEEEEEEE"));
                    %>
                    <h4>Click here To Access WebApp_A</h4>
                    </body>
                    </html>
                    ----------------------
                    ----------------------
                    WebAppEar/META-INF/weblogic-application.xml

                    <?xml version="1.0" encoding="UTF-8"?>
                    <weblogic-application xmlns="http://www.bea.com/ns/weblogic/90">
                    <session-descriptor>
                    <persistent-store-type>memory</persistent-store-type>
                    <sharing-enabled>true</sharing-enabled>
                    </session-descriptor>
                    </weblogic-application>
                    ----------------------
                    ----------------------

                    WebAppEar/META-INF/application.xml

                    <?xml version="1.0" encoding="UTF-8"?>
                    <application xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.4">
                    <module>
                    <web>
                    <web-uri>WebApp_A</web-uri>
                    <context-root>WebApp_A</context-root>
                    </web>
                    </module>
                    <module>
                    <web>
                    <web-uri>WebApp_B</web-uri>
                    <context-root>WebApp_B</context-root>
                    </web>
                    </module>
                    </application>
                    ----------------------
                    ----------------------


                    There is no additional changes i have made either in Server Config or in Application...I am able to access the Shared Session....Which was created by WebApp_A into WebApp_B.

                    Please let me know if you are doing any additional thing...or if my understanding to the post is not clear.



                    Thanks
                    Jay SenSharma
                    http://jaysensharma.wordpress.com/generalweblogic/ (WebLogic Wonders Are Here)

                    Edited by: Jay SenSharma on Jan 12, 2010 2:03 PM
                    • 7. Re: HTTP Session sharing across multiple EARs /Applications
                      690917
                      Hi Jay

                      it seems , u are talking about session sharing between two war/web app


                      My requirement is session sharing between two ear files

                      ie App1.ear, App2.ear

                      both contains webapp.war file

                      please advice

                      regards
                      Jeethi George
                      • 8. Re: HTTP Session sharing across multiple EARs /Applications
                        Jay SenSharma MiddlewareMagic
                        Hi Jeethi,

                        This is not possible for Two different Enterprise applications to share their HttpSession Object.

                        Yes but it is possible that if an Enterprise Application contains multiple WebApplications then the HttpSession can be shared between those WebApplications which are part of the Same EAR (Enterprise).


                        Thanks
                        Jay SenSharma
                        http://jaysensharma.wordpress.com/generalweblogic/ (WebLogic Wonders Are Here)
                        • 9. Re: HTTP Session sharing across multiple EARs /Applications
                          690917
                          Hi Jay

                          I dont think so ,


                          how Google and all managing session across their sites

                          Regards,
                          Jeethi George
                          • 10. Re: HTTP Session sharing across multiple EARs /Applications
                            Jay SenSharma MiddlewareMagic
                            Hi Jeethi,

                            You are talking about Single Sign On.....That is Possible Even in WebLogic... You can Use SAML Techniques in WebLogic for Single Sign on purpose...

                            <font color=red> But SSO is not Achieved PURELY at the HttpSession level....there are many other components involved in it.
                            </font>

                            Please have a look on the below Link:
                            http://www.oracle.com/technology/pub/articles/dev2arch/2006/12/sso-with-saml.html

                            AND

                            http://www.oracle.com/technology/pub/articles/dev2arch/2006/12/sso-with-saml5.html



                            Thanks
                            Jay SenSharma

                            Edited by: Jay SenSharma on Jan 12, 2010 5:46 PM
                            • 12. Re: HTTP Session sharing across multiple EARs /Applications
                              720457
                              Hi Guys,

                              So does this mean we cannot share the session across the cluster? Each managed server in a cluster will contain its' own copy of the ear file.

                              I ran a test and I cannot replicate the session from App 1 in Managed server 1 and App 1 in Clustered Managed server 2.

                              Please advice.

                              Thanks.

                              - Regie
                              • 13. Re: HTTP Session sharing across multiple EARs /Applications
                                Jay SenSharma MiddlewareMagic
                                Hi Regie,

                                It is quite possible to replicate session across the Cluster : http://download-llnw.oracle.com/docs/cd/E12840_01/wls/docs103/cluster/failover.html#wp1040345

                                WebLogic server provides the ability to replicate HTTP session state across multiple clusters. This improves high-availability and fault tolerance by allowing clusters to be spread across multiple geographic regions, power grids, and internet service providers

                                Thanks
                                Jay SenSharma
                                http://jaysensharma.wordpress.com/ (WebLogic Wonders Are Here)
                                • 14. Re: HTTP Session sharing across multiple EARs /Applications
                                  user161771 - oracle
                                  Oracle Coherence has functionality to enable sharing sessions across WebLogic and other types of java application servers, it's called Coherence*Web.
                                  http://coherence.oracle.com/display/COH35UG/Coherence*Web+Session+Management+Module
                                  http://coherence.oracle.com/display/COH35UG/Coherence*Web+Session+and+Session+Attribute+Scoping
                                  1 2 Previous Next