5 Replies Latest reply on May 24, 2006 12:24 AM by 807581

    session sharing acrossed ears

      Is it possible to share a session across multiple EAR's? I have successfully shared sessions across multiple WAR's in a single EAR by using the session scoping and session path information.
        • 1. Re: session sharing acrossed ears
          I think sharing sessions is possible only with .war files and not with the application(.ear files), my opinion is that, sessions are bound with application therefore any module/component within the application can make a reference to the session. On the other hand, a module/component, in a different application will know only it's session to which the .ear file has binded into and therefore not possible to access session which is established by a different application.

          Ganesh .R
          Developer Technical Support
          Sun Microsystems
          • 2. Re: session sharing acrossed ears
            Hi can u please tell me how can i share session between multiple war's present in single ear.

            Thanks in advance
            • 3. Re: session sharing acrossed ears
              Ganesh hi,

              I am looking at the possibility of sharing the session to multiple WARs, can you point us to the right direction. Give us at least a hint.

              • 4. Re: session sharing acrossed ears
                According to the spec, Sessions aren't suppose cross WARs. However, with IBM's Websphere, you are able to "enable" "Shared Session Context" across multiple WARS in a single EAR and provided the virtual domains for each WAR are the same.

                This is nice because it gives a developer the flexibility to logically breakup a large site into multiple war applications under the same EAR without having to worry about session management. For example, you can have a BrochureWAR, LoginWAR and a MemberForumWAR, MemberPaymentWAR, etc... all in the same EAR. The LoginWAR would put a UserObject into Session and the other MemberWARs could use it. Otherwise you would have to use the dreaded EJB solution or roll-your-own webservice state machine.

                As a quick note, be sure that any Object you put into the Shared Session Context is loaded using the Server's classpath and not the WAR's classpath. If you don't and you load a FooObject from WAR1 lib into session, a read from Session by WAR2 will throw a ClassNotFound error because of differing classloaders. Know what I mean?

                Now with all that said, I want Shared Sessions across EARs (obviously for WARs of the same domain of course). In this way, I would be able to completely remove/upgrade certain area's of a Very Large webappliction without effecting other areas for example: someWebSitesMemberPaymentEAR without effecting someWebSitesMemberForumEAR. Of course I could achieve this with all webapplications calling some Stateful WebService or EJB thing backend too but GOSH... thats alot of work for Session Management across EARs. Where's the easy button?
                • 5. Re: session sharing acrossed ears
                  Did you ever solve this? i am struggling with a similar idea. I have a "very large" application which I want to make more modular so I can upgrade/add/redeploy parts, both in the Web container and the EJB container, without having to build an entirely new set of EJB-jars, wars, ear and redeploy.