当我无法访问 CLI 工具时,如何关闭 JBoss Wildfly?

How do I shutdown JBoss Wildfly when I can't access the CLI tool?

我正在使用 Wildfly 10.0.0.CR2 和 Java 8。我让 Wildfly 在端口 8080 上侦听 http 连接,并且过去曾使用此命令关闭服务器 ...

./jboss-cli.sh --connect command=:shutdown

然而,有时我无法访问此工具,即使服务器仍然 运行。请注意下面在我的 Mac ...

上的互动
Daves-MacBook-Pro-2:bin davea$ ./jboss-cli.sh --connect command=:shutdown
Failed to connect to the controller: The controller is not available at localhost:9990: java.net.ConnectException: WFLYPRT0023: Could not connect to http-remoting://localhost:9990. The connection timed out: WFLYPRT0023: Could not connect to http-remoting://localhost:9990. The connection timed out
Daves-MacBook-Pro-2:bin davea$ telnet localhost 8080
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

我的问题是,关闭 JBoss 服务器的万无一失的方法是什么?注意我更喜欢不依赖于 CLI 工具的方法。

我怀疑它有时无法连接,因为我在telnet 上看到localhost 首先解析为ipv6。你试过了吗:

./bin/jboss-cli.sh --connect controller=127.0.0.1:9990 command=:shutdown

除此之外,您始终可以终止 PID:

pgrep -d" " -f "wildfly" | xargs kill;

停止 Wildfly:

$ ./jboss-cli.sh --connect command=:shutdown