将jboss 7安装成系统服务

本文自:https://community.jboss.org/wiki/RunningJBossAS7AsAWindowsService

首先从地址 http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10 下载最新的jboss native文件,将其copy到jboss的bin目录下,原bin目录是不会有native包里的东西的。然后依次进行以下操作即可

  1. 修改service.bat文件,将里面的SVCNAME, SVCDISP and SVCDESC分别修改为自己想要安装成服务的相关信息,即服务名,服务标识以及服务描述信息。
  2. 修改里面的JAVA_OPTS信息配置信息,以配置相应的java内存配置信息,在原service.bat文件中,有默认的-Xrs选项,不过这个选项先不能删掉,以避免某些远程桌面信息会导致jboss停掉的问题。此外,还需要配置比如JAVA_HOME等信息。
  3. 将service.bat中的所有run.bat修改为standalone.bat,在最新的jboss版本中,已不再使用call.bat了。
  4. 将service.bat中关于停止服务的 call shutdown 部分修改为 call jboss-cli.bat –connect command=:shutdown >> shutdown.log 2>&1。因为已经没有shutdown.bat这个文件,如果不修改的话,此调用将直接重启机器。此外,如果配置多个jboss,只需要在后面追加 –controller=host:mport 即可。
  5. 在cmd下运行 service.bat install安装服务,然后在服务中将其启动方式修改为auto即可。

另附:英文原始文档。

There are a few threads touching this topic but I thought I'd summarize my findings so far in getting JBoss AS 7 up and running as a Windows service.

1 First of all, grab the appropriate native connectors from http://www.jboss.org/jbossweb/downloads/jboss-native-2-0-10 (x86 for 32bit host, x64 for 64bit).
Unzip the archive in the JBoss main folder. Then make some modifications to the service.bat file
2 Rename the SVCNAME, SVCDISP and SVCDESC to something more meaningful. This is optional but if you plan to install multiple servers
 (e.g. test and production, you want different names.
3 Modify the JAVA_OPTS to increase memory, service.bat doesn't read any other conf.bat file so it will use default memory settings 
and will die of memory loss for a mid-sized deployment. Keep the -Xrs setting as I've seen cases where a RDP logout has caused JBoss
 to shut down. You might also want to add a JAVA_HOME if it's not set as a system wide environment variable
4 Change all run.bat calls to standalone.bat calls as they are called nowadays
5 Comment out all "call shutdown" calls and replace then with call jboss-cli.bat --connect command=:shutdown >> shutdown.log 2>&1.
 This is especially important because the shutdown.bat that was around before is no longer there and it will probably run shutdown.exe
 from system32 instead, causing a server shutdown. If you run multiple servers you must config the CLI script to connect to the 
correct management ports set in standalone.xml by adding a --controller=host:mport to the bat call.
6 Install the service with "service install". You might also want to change the service starting mode to "automatic" and change 
the "run as" to a normal user. Note that on later Windows-versions, you must run the executing cmd in administrator mode.

转载请标明出处:i flym
本文地址:https://www.iflym.com/index.php/code/201210230002.html

相关文章:

作者: flym

I am flym,the master of the site:)

发表评论

邮箱地址不会被公开。 必填项已用*标注