geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amit Puri <puri.a...@gmail.com>
Subject Utilizing Geronimo monitoring through command line
Date Fri, 28 May 2010 14:00:59 GMT
Hi,

I am looking in a scenario of a business infrastructure where admin console
is disallowed and user still want to use and watch capabilities of Geronimo
monitoring portlet functionality without logging in admin console.

First step for me to achieve this is to start and stop Stat Query through a
command line. So I am trying to start Snapshot (Stat. Query) in monitoring
portlet of Geronimo 2.1.5 with a java program.

Through Admin console I can start it without any fail by clicking on "Enable
Query". when I start it with a java program I am able to start snapshot
(Stat. Query) but I am also getting following error in command prompt:

*...
ERROR [MasterRemoteControlJMX]
org.tranql.connector.jdbc.TranqlDataSource$SelfReference incompatible with
javax.sql.DataSource
java.lang.ClassCastException:
org.tranql.connector.jdbc.TranqlDataSource$SelfReference incompatible with
javax.sql.DataSource
        at
org.apache.geronimo.monitoring.MasterRemoteControlJMX.<init>(MasterRemoteControlJMX.java:110)
        at
org.apache.geronimo.monitoring.snapshot.SnapshotProcessor.getMRC(SnapshotProcessor.java:148)
        at
org.apache.geronimo.monitoring.snapshot.SnapshotProcessor.takeSnapshot(SnapshotProcessor.java:59)
        at
org.apache.geronimo.monitoring.snapshot.SnapshotThread.run(SnapshotThread.java:103)
...*

In my java program, I am following these steps:

1.Creating MBeanServerConnection object
*...
MBeanServerConnection mbServerConn;
JMXServiceURL serviceURL = new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost/JMXConnector");
Hashtable<String, Object> env = new Hashtable<String, Object>();
String[] credentials = new String[2];
credentials[0] = "system";
credentials[1] = "manager";
env.put(JMXConnector.CREDENTIALS, credentials);

JMXConnector connector = JMXConnectorFactory.connect(serviceURL, env);
mbServerConn = connector.getMBeanServerConnection();
..*

2. Retrieving the mbean name to the agent-car-jmx plugin

*..
if(PATH == null) {
Set<ObjectName> mbeanNames = mbServerConn.queryNames(new
ObjectName("*:name=MasterRemoteControlJMX,*"), null);
for(Iterator<ObjectName> it = mbeanNames.iterator(); it.hasNext(); ) {
String mbeanName = ((ObjectName)it.next()).getCanonicalName();
if(mbeanName.contains("agent-car-jmx") &&
mbeanName.contains("MasterRemoteControlJMX") && mbeanName.contains("GBean"))
{
PATH = mbeanName;
break;
}}
if(PATH == null) {
throw new Exception("[ERROR] Required mbean not found: agent-car-jmx");
}}
..*

Here I am getting mbean name as
"geronimo:J2EEServer=geronimo,ServiceModule=org.apache.geronimo.plugins.monitoring/agent-car-jmx/2.1.5/car,j2eeType=GBean,name=MasterRemoteControlJMX"

3. Invoking startSnapshot

*..
long time = 60000;
int days = 2;
mbServerConn.invoke(new ObjectName(PATH),"startSnapshot", new Object[] {
time, days }, new String[] { "java.lang.Long", "java.lang.Integer" });
..*
After invoking, I can see snapshot running but also getting
ClassCastException.


I am getting *SUCCESS* when I use this java client with *G 2.1.4 without any
exception*. When I checked code change in 2.1.5, I can see change in
plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/
*MRCConnector.java. *
One JIRA is there for this change *"GERONIMO-4823 role-based administration
capabilities" *Change in MRCConnector.java is like this-

*code-snippet of MRCConnector.java
..
 mbServerConn =
((RealMBeanServerReference)PortletManager.getKernel().getGBean("MBeanServerReference")).getMBeanServer();
..*

I have also checked the *MasterRemoteControlJMX.java* where
ClassCastException is coming, I can see error in "archiveDS"

*code-snippet of MasterRemoteControlJMX.java
..
activeDS =
(DataSource)ic.lookup("jca:/org.apache.geronimo.plugins/agent-ds/JCAManagedConnectionFactory/jdbc/ActiveDS");
archiveDS =
(DataSource)ic.lookup("jca:/org.apache.geronimo.plugins/agent-ds/JCAManagedConnectionFactory/jdbc/ArchiveDS");
..*

when I invoked start snapshot through my java client, For activeDS, object
created is of TranqlDataSource and for archiveDS, it is of
TranqlDataSource$SelfReference.

Please help me in understanding this behavior and give me some pointers to
go forward in this effort. I really appreciate your help.

Thanks.

Mime
View raw message