本文档来自GlassFish官方网站,详细介绍了将 GlassFish 作为 Windows 服务运行设置方法。
Glassfish 附带一个名为 appservService.exe 的 Windows 可执行文件,它可与
Windows 服务控制器通信。其工作方式类似于 Java Service Wrapper 等程序。您为 Glassfish 创建的
Windows 服务使用几个参数来启动 appservService.exe,这些参数告知它在启动和停止时要执行哪些 asadmin 命令。
Glassfish 并未附带可为 appservService.exe 轻松创建 Windows 服务的工具,但是 Sun Java
Application Server 9.x 的安装程序有一个 "Install as a Windows service" 复选框。如果您要为
Glassfish 创建 Windows 服务,则该说明中给出了可从命令提示符运行的一个相当大的命令。如果 Glassfish
安装路径包含空格,例如 C:\Program Files\Sun\GlassfishV2
-i Installs a Windows service for Glassfish.
-u Uninstalls a Windows service for Glassfish.
-n name Name for the Windows service. Use double quotes around names
that contain spaces. Defaults to GlassfishAppServer.
-d path Directory where Glassfish is installed. Use double
quotes around paths with spaces, and escape back slashes.
Defaults to current directory.
-m domain Name of the Glassfish domain to start and stop. Defaults to
domain1.
-a user Glassfish admin user name. Defaults to admin.
-p pwd Glassfish admin password. A password.txt file will be created
in the Glassfish install directory containing the password in
plain text, and the Windows service will be configured to read
from it. This is usually not necessary. If no password is passed
in, the password.txt file will not be created.