JBoss 7 CLI to query all the deployed applications

浪尽此生 提交于 2019-12-07 06:24:15

问题


Using JBoss 7's jboss-cli I can query the deployed applications:

[standalone@localhost:9999 /] deployment-info --headers=
NAME                 RUNTIME-NAME         PERSISTENT ENABLED STATUS
jboss-ejb-in-ear.ear jboss-ejb-in-ear.ear true       true    OK
singleton_in_war.war singleton_in_war.war true       true    OK

Programatically I can query any CLI query starting with /, for example this:

/path=jboss.server.log.dir:read-attribute(name=path)

where the address is

/path=jboss.server.log.dir

and the operation is

read-attribute(name=path)

My question is, for the CLI query

deployment-info --headers=

what is the address and what is the operation?

Best regards, SK


回答1:


I've found this solution useful for querying the deployed applications in standalone mode by using CLI api.

The CLI query is:

/deployment=*:read-attribute(name=name)

where the address "/deployment=*" will target all the deployments. And basically requests the name attribute for all deployments in current server.

Finally this snippet shows the code for executing the query by using the model controller api:

ModelControllerClient client = "...create the controller client";

ModelNode operation = new ModelNode( );
operation.get( "address" ).add( "deployment", "*" );
operation.get( "operation" ).set( "read-attribute" );
operation.get( "name" ).set( "name" );

ModelNode result = client.execute( operation );

List<ModelNode> deployments = result.get( "result" ).asList();
String deploymentName;

// finally we can iterate and get the deployment names.
for ( ModelNode deployment : deployments ) {
    deploymentName = deployment.get( "result" ).asString();
    System.out.println( "deploymentName = " + deploymentName );
}

Works for both WF10 and EAP7




回答2:


Did you try this command?

/server-group=*/deployment=*/:read-resource(recursive=false,proxies=true,include-runtime=true,include-defaults=true)

You can navigate the model nodes and get the details you needed.




回答3:


The deployment-info command only has the options --name and --headers. Using the command deployment-info --name=singleton_in_war.war you can narrow the infomation to this deployment only.

The --help option shows you the online help for deployment-info:

[standalone@localhost:9999 /] deployment-info --help
SYNOPSIS

Standalone mode:

deployment-info [--name=wildcard_expression]
                [--headers={operation_header (;operation_header)*}]

Domain mode:

deployment-info --name=deployment_name |
                --server-group=server_group [--name=wildcard_expression]
                [--headers={operation_header (;operation_header)*}]

DESCRIPTION


Displays information about single or multiple deployments.

In the standalone mode the --name argument is optional.
If it's absent, the command will display information about all the
registered deployments. Otherwise, the value of the --name is either a
specific deployment name or a wildcard expression.
...



回答4:


Enter:

deployment-info --name=  

and then press tab. It will autocomplete all deployments.



来源:https://stackoverflow.com/questions/21928887/jboss-7-cli-to-query-all-the-deployed-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!