3 Replies Latest reply: Jan 31, 2012 1:22 PM by Earnest Dyke RSS

How EAR packages and beans can share session id?

Peter Penzov Newbie

    I have 3 EAR packages which combined together makes one huge web java application. Is it possible to configure the beans into the packages to share the session id data between them. My idea is to develop a login form which registers users into database tables using session id. Every time then users browse the application their session id is used to identify the users. The tricky part comes when users switch between different EAR packages and beans. The session id will change and other beans won't know what is the new session id. Is there a way to configure the beans into the EAR packages to share the data which contains the session id.

 

Kind regards Peter  

  • 1. Re: How EAR packages and beans can share session id?
    Michael Nielson Newbie

    You can get all three web apps to share the same JSESSIONID by setting the <Manager pathname=""/> setting in WEB-INF/context.xml (this has changed a few times between underlying tomcat versions).

     

    This doesn't solve your problem though, even though all three sessions will share the same JSESSIONID they will still access the session from a different context so their session data will be separate from each other.

     

    Sorry I don't have much more to tell you I just stumbled through this same problem.

  • 2. Re: How EAR packages and beans can share session id?
    Peter Penzov Newbie

    My idea is to create a login page which after successfull login takes the cookie session id and the IP address of the users and place them into tables into database. So when user wants to access one of the modules session bean every time takes the cookie and the IP address and compares them with the one from the database. The key point here is the session id. In every module it must be the same. I will make tho identical EAR packages and I will configure JBoss to see is this going to work.

     

    Regards

    Peter

  • 3. Re: How EAR packages and beans can share session id?
    Earnest Dyke Novice

    Peter,

     

    Did you ever resolve this? I added the following to my web.xml and was able to get the same session id for both of my web apps but the sessions do not contain the same data.

     

    Earnie!

     

    <session-config>
      <cookie-config>
        <path>/</path>
       </cookie-config>
    </session-config>