1 Reply Latest reply on Feb 10, 2007 7:19 AM by Michael Semb Wever

    Howto, when user logs out, invalidate session & remove all e

    Michael Semb Wever Newbie

      I'm having problems with my JBoss Portal Seam application.
      I have two portlets, one for my application and the other to handle user
      actions (eg my preferences and log out).

      When the user logs out in one portlet my seam actions (and it's ejb3s) are
      not passivated. When the session timeouts sometime later then they are
      passivated.
      This is not acceptable for us, for security and application reasons as
      soon as the user logs out we need all ejb3s to be removed. If the logout
      action was within the same application portlet it wouldn't be an issue,
      but there appears to be no way to remove ejb3s from a different portlet.

      I've tried to through the PolicyContext getting the HttpSession and calling
      invalidate on it. But it throws an exception because the response has
      already been committed.

      I've searched for some way to trigger a EJB3 cache cleanup, presuming that
      the EJB3s in my application portlet are otherwise ready to passivate but
      that the cache just needs to see it, without finding any API to help.

      The only way I can think of solving this is using MessageDrivenBeans that
      the logout action sends a message and my application can listen to and
      manually call remove on my ejb3s.

      But I just can't believe this is the correct way to do something that
      should be so simple.

      Have I missed some really obvious way to invalidate my session and force
      remove all my ejb3s?

      Or does anyone have any other way to achieve this?