2 Replies Latest reply on Aug 7, 2009 8:23 AM by Georges Berscheid

    Persist sessions across restarts and redeployments

    Georges Berscheid Newbie


      is there any way to persist Seam sessions so that they can be restored after a complete server restart or redeployment of the application?

      Due to the PermGen space problem with the Sun VM, I'm forced to restart my JBossAS (4.2.2) regularly. This means that even though I redeployed application A 3 times, all the users logged in to application B have to relogin and lose all their session-scoped information.

      I've tried setting a manager pathname in $JBOSS_HOME/server/default/deploy/jboss-web.deployer/context.xml to enable session persistence, but doesn't prevent Seam from creating a new session after restarting the server.

      Is there any recommended way of doing this?

      Thanks a lot,


        • 1. Re: Persist sessions across restarts and redeployments
          Arbi Sookazian Master

          Short answer: no, not that I'm aware of.  The only context in Seam that outlives a server restart is BUSINESS_PROCESS context.

          If you really want to avoid the PermGen out of space problem, use a JVM that does not have a PermGen space like Oracle JRockit.

          Is your environment a 2 node horizontal JBoss cluster or what?  If state replication is turned on, the HTTP session state and SFSB state should be replicated to the other nodes in your cluster, typically after each business method in a SFSB, for example, successfully completes.  If the node for that client's session fails, then the state should be pre-replicated for the subsequent HTTP request from that same client that will hit another active node in the cluster.  This is seamless failover which preserves the user's session data and typically re-authentication is not required.  Essentially, the user should not even know that a node failed in the JBoss cluster.

          Your other option is to increase the PermGen allocation in the JVM arguments.

          I use this JVM tuning based on DAllen's recommendation in SiA book for my local JBoss and have not run out of PermGen space in a long time:


          note that in prod you want to pin the max and min Heap space allocation to the same size (i.e. -Xms512m -Xmx512m).  Read JBoss in Action tuning section for more info.

          • 2. Re: Persist sessions across restarts and redeployments
            Georges Berscheid Newbie

            Hi Arbi,

            thanks a lot for your detailed reply. I was kinda hoping for a quick fix, but I guess I will have to go for the 'session replication across cluster nodes' solution.

            Until I have that set up, I'll use the PermGen configuration above to minimize restarts of the server.

            Thanks a lot,