3 Replies Latest reply on Jul 20, 2006 6:42 AM by armorris007

    Cluster-wide Session Access

    armorris007

      I'm currently trying to find a way to gain access to a cluster-wide list of active Tomcat Sessions. This is proving very difficult.

      I've looked at the possibility of using the HttpSessionListener interface but unfortunately that won't suffice - as it's not fail-safe when it comes to a node in a cluster unexpectedly going away.

      The problem I'm trying to tackle is that of implementing a session-tracking licencing engine for our J2EE product. Essentially - I want to be able to read an attribute (that is set at login) from a session and count how many sessions have that attribute set.

      Having scoured the JMX console for ways that existing JMX components get this information, it would appear that such information is available to:

      The MBEAN registered under the jboss.web domain:
      host=localhost,path=/myapplication,type=Manager

      however, I can't for the life of me work out how to do a JNDI lookup to get access to that MBEAN - it doesn't appear to be registered in JNDI (when using the JNDIView component).

      However - the jmx-console itself can see the component fine - and can execute calls on it.

      Can anyone help? Or advise an alternative solution to cluster-wide session access?

      Many thanks,

      Andy

        • 1. Re: Cluster-wide Session Access
          peterj

          You have to look up the MBEan via the MBean Server, which you look up in JNDI. See http://www.jboss.com/index.html?module=bb&op=viewtopic&t=84303 for a full example.

          • 2. Re: Cluster-wide Session Access
            armorris007

            Hi Peter,

            Many thanks! Very useful!

            I do however have one major problem, the MBean "MANAGER" for my application no longer seems to be auto registering itself with the MBeanServer - and I don't know why.

            See JMX console entries:

            host=localhost,path=/myapp,type=Cache
            host=localhost,path=/web-console,type=Cache
            host=localhost,path=/web-console,type=Manager

            The following is missing:
            host=localhost,path=/myapp,type=Manager

            I have a Cache MBean but no Manager MBean for 'myapp'.

            I can't recall changing any particular configuration for that application which would do this?

            Which component is responsible for registering "Manager MBeans" against deployed web applications?

            Cheers,

            Andy

            • 3. Re: Cluster-wide Session Access
              armorris007

              To answer my own question - it appears that having

              "<distributable/>"
              set in the application's web.xml causes the Manager to not register.

              Cheers,

              Andy