java - 从 shell 脚本停止 jboss 5.x

标签 java linux shell jboss jboss5.x

我正在编写一些小型 shell 脚本实用程序,它可以自动执行部署过程。我准备了许多与在 Linux 中关闭 jboss 服务器的命令相关的链接,以便我可以从我的实用程序中关闭服务器。

阅读一些链接,这些链接将告诉您如何在 jboss 7 或更高版本中执行此操作,但不能在旧的 jboss 版本(如 5.x)中执行此操作。其中之一是

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

我想从我的 shell 脚本关闭 jboss 5.2 版本?

编辑:Jboss 5版本的bin文件夹中有shutdown.sh。但当我说

时,我遇到了以下异常
sh shutdown.sh -S


[john@mymachine bin]$ sh shutdown.sh  -S
Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]]
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1851)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:720)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
    at javax.naming.InitialContext.lookup(InitialContext.java:411)
    at org.jboss.Shutdown.main(Shutdown.java:225)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:362)
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:287)
    at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1821)
    ... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]
    at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:332)
    ... 6 more
Caused by: java.net.ConnectException: Connection refused

有什么想法吗?

问候

最佳答案

JBoss 5 有一个 shutdown.sh,来自 docs :

usage: shutdown [options] <operation>

options:
  -h, --help              Show this help message (default)
  -D<name>[=<value>]      Set a system property
  --                      Stop processing options
  -s, --server=<url>      Specify the JNDI URL of the remote server
  -n, --serverName=<url>  Specify the JMX name of the ServerImpl
  -a, --adapter=<name>    Specify JNDI name of the MBeanServerConnection to use
  -u, --user=<name>       Specify the username for authentication
  -p, --password=<name>   Specify the password for authentication

operations:
  -S, --shutdown          Shutdown the server
  -e, --exit=<code>       Force the VM to exit with a status code
  -H, --halt=<code>       Force the VM to halt with a status code

关于java - 从 shell 脚本停止 jboss 5.x,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34629318/

相关文章:

java - Spring注释事务中的全局配置?

java - 如何对方法的立即退出进行单元测试

linux - Apache 日志 : Count top 10 URLs by bytes served

LINUX - saltstack cmd.run 在变量中

linux - 文件夹数返回为零值

java - 引发主逻辑循环中断

java - android从2个不同的文件读取

c - 查看(但不拦截)到 Linux 计算机的所有 IPv4 流量

linux - C++ 程序在启动 Ubuntu 服务器时启动

linux - 使用 procmail 触发应用程序在我的计算机上运行...但我遇到了障碍