duan xz [
http://community.jboss.org/people/duanxz] created the discussion
"Re: JMX-based monitoring the jbossAS7 database connection pool"
To view the discussion, visit:
http://community.jboss.org/message/631472#631472
--------------------------------------------------------------
Hi Braun,
Thanks a lot for your help and tips.
I want to read All datasources,according to your advice, my code is as follows, but I
have trouble converting the CLI to Java code:
================================================
===CLI command:
[standalone@192.0.0.204:9999 subsystem=datasources]
:read-children-resources(child-type=data-source)
{
"outcome" => "success",
"result" => {
"abc" => {
....
....
===java code:
ModelControllerClient.Factory factory = new ModelControllerClient.Factory();
ModelControllerClient client =
factory.create(InetAddress.getByName("192.0.0.204"), 9999);
+ModelNode op = new ModelNode();+
+op.get("operation").set("read-children-resources");+
+op.get("recursive").set(true);+
+op.get("operations").set(true);+
+ModelNode address = op.get("address");+
+address.add("subsystem", "datasources");+
+address.add("datasource", "jndi-name");+
System.out.println(op);
try {
ModelNode returnVal = client.execute(op);
System.out.println(returnVal);
} catch (IOException ie) {
// TODO Auto-generated catch block
ie.printStackTrace();
}
================================================
error trace:
------------------------------------------------
{
"outcome" => "failed",
"failure-description" => "No handler for operation read-child
ren-resources at address [
(\"subsystem\" => \"datasources\"),
(\"datasource\" => \"jndi-name\")
]",
"rolled-back" => true
}
-------------------------------------------------
I don't know with the ModelNode parameter Usage.
Could you please help me with this one?
Thanks a lot,
duanxz
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/631472#631472]
Start a new discussion in JBoss AS7 Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]