JBoss Community

Re: JMX-based monitoring the jbossAS7 database connection pool

created by duan xz in JBoss AS7 Development - View the full discussion

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

Start a new discussion in JBoss AS7 Development at Community