You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Charl Gerber <ch...@yahoo.com> on 2005/06/14 18:09:15 UTC

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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using Catalina API

Posted by Patrick Thomas <ps...@gmail.com>.
Hi Charl,

Dunno about a method call that you'd be able to make, but this may get
you half way there:

http://localhost:8080/manager/list

Straight text response, easy to parse. Now, the catch is, you'll need
to be authenticated on the server. Ant has some tools that you may be
able to make use of:
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant

Cheers,
PST

On 6/14/05, Charl Gerber <ch...@yahoo.com> wrote:
> 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: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Using Catalina API

Posted by Rick <to...@vidyah.com>.
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:charlgerber@yahoo.com] 
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org