We get a list of sessions from a specific webapp by using the JMX interface,
once you get a connection you could get a list of all "manager" mbeans
(webapps) and then invoke the listsessions method on each manager to get a
list of sessions..

However.. This only seems to work with the older 1.1.1 version of MX4J and
for some reason, I can't get anyone to give me a clue as to how to use the
3.0.1 newer version properly, from the tomcat list nor the MX4J list.   The
1.1.1 version has the bad side-effect of not always cleaning up its threads
and can hang tomcat on shutdown.

This was used on Tomcat 5.0.28, using the MX4J 1.1.1 libs.

-- conf/jk2.properties --------------------
mx.port=1099
mx.enabled=true
mx.jrmpPort=1099
mx.jrmpHost=localhost

-- Code ------------------------------ 
Hashtable environment = new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
 "com.sun.jndi.rmi.registry.RegistryContextFactory");
environment.put(Context.PROVIDER_URL,"rmi://localhost:1099");

JRMPConnector connector = new JMRPConnector(); 
connector.connect("jrmp", environment);

RemoteMBeanServer server = connector.getRemoteMBeanServer();

ObjectName ob = new ObjectName("mywebapp");
Object[] params = {};
String[] signature = {};
                
String result =
(String)mServer.invoke(ob,"listSessionIds",params,signature);

----------------------------------------

-Rick

-----Original Message-----
From: Charl Gerber [mailto:[EMAIL PROTECTED] 
Posted At: Tuesday, June 14, 2005 9:09 AM
Posted To: Tomcat Dev
Conversation: Using Catalina API
Subject: Using Catalina API


How can you determine all the loaded webapps and active sessions across all
webapps using the Catalina (or other Tomcat) API? The Javadoc does not seem
to provide a sort of utility class with static methods to get this info.

Thanks

Charl


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to