0

我一直在尝试使用 jboss-cli.bat 验证我们的服务器是否已在 Wildfly 中启动

这是我正在使用的命令:

/host=slave-1/server-config=REST-server-one:read-resource(include-runtime=true)

这就是我从命令中得到的

{
    "outcome" => "success",
    "result" => {
        "auto-start" => true,
        "cpu-affinity" => undefined,
        "group" => "wildfly-server-group",
        "name" => "wildfly-server",
        "priority" => undefined,
        "socket-binding-default-interface" => undefined,
        "socket-binding-group" => undefined,
        "socket-binding-port-offset" => 0,
        "status" => "STARTED",
        "update-auto-start-with-server-status" => false,
        "interface" => undefined,
        "jvm" => undefined,
        "path" => undefined,
        "ssl" => undefined,
        "system-property" => undefined
}

是否有一个命令将返回该响应中的状态值?

4

2 回答 2

1

您应该可以使用该read-attribute操作。

/host=slave-1/server-config=REST-server-one:read-attribute(name=status)
于 2018-01-17T21:48:02.363 回答
0

我最终使用这个

BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

            String line = reader.readLine();
            while (line != null) {
                String[] value  = line.split("=>");
                if(value.length > 1){
                    if(value[0].contains("\"status\"")){
                        System.out.println(value[1]);
                    }
                }
                line = reader.readLine();
            }

如果有人能提出更好的方法,将不胜感激。

于 2018-01-16T06:13:23.790 回答