windows 如何使用 standalone-full.xml 作为服务启动 WildFly?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28854158/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to start WildFly as a service with standalone-full.xml?
提问by fatdevelops
WildFly provides a service.bat
in %WILDFLY_HOME%\bin\service
. Calling the batch file with the install
parameter installs WildFly as a service on Windows.
WildFly 提供了一个service.bat
in %WILDFLY_HOME%\bin\service
. 使用install
参数调用批处理文件会将 WildFly 作为服务安装在 Windows 上。
I have made changes to the standalone.conf
and need to use the standalone-full.xml
in my setup. Hence, I would like to start the WildFly service with these parameters on Windows. Is it possible? How do I do it?
我已经更改了standalone.conf
并且需要standalone-full.xml
在我的设置中使用 。因此,我想在 Windows 上使用这些参数启动 WildFly 服务。是否可以?我该怎么做?
回答by Sevan
Yes, It is possible. You should only change SERVER_OPTS variable on standalone.batfile. In addition, you do not have to make changes on standalone.conf.
对的,这是可能的。您应该只更改standalone.bat文件上的 SERVER_OPTS 变量。此外,您不必对standalone.conf进行更改。
Put below line and try again.
放在下面的行,然后再试一次。
set "SERVER_OPTS=--server-config=standalone-full.xml"
回答by Bj?rn Stenfeldt
Just create the service with the command service.bat install /config standalone-full.xml
只需使用命令创建服务 service.bat install /config standalone-full.xml
回答by Yves Martin
When running WildFly standalone server as a Windows service, service install
registers start command standalone.bat
with no option.
将 WildFly 独立服务器作为 Windows 服务运行时,不带选项service install
注册启动命令standalone.bat
。
By default, standalone.bat
loads standalone.conf.bat
, and not standalone.conf
which is designed to Unix platforms.
默认情况下,standalone.bat
加载standalone.conf.bat
,而不是standalone.conf
专为 Unix 平台设计的。
It is possible to load a specific standalone.conf.bat
file setting environment variable STANDALONE_CONF
with its path. There, it is possible to set JAVA_OPTS
options but not server options.
可以使用其路径加载特定的standalone.conf.bat
文件设置环境变量STANDALONE_CONF
。在那里,可以设置JAVA_OPTS
选项,但不能设置服务器选项。
To avoid to edit WildFly release standalone.bat
file, I recommend to create a copy of bin/service/service.bat
as bin/service/service-myproject.bat
where you can adapt start parameters and add --server-config
:
为了避免编辑WildFly发布standalone.bat
文件,我建议创建的副本,bin/service/service.bat
因为bin/service/service-myproject.bat
在那里你可以适应启动参数,并添加--server-config
:
set STARTPARAM="/c \"set NOPAUSE=Y ^^^&^^^&
standalone.bat --server-config=standalone-full.xml\""
At the same time, this specific service-myproject.bat
allows you to tune your service installation with SHORTNAME
, DISPLAYNAME
and DESCRIPTION
variables.
同时,此特定service-myproject.bat
功能允许您使用SHORTNAME
、DISPLAYNAME
和DESCRIPTION
变量来调整服务安装。
Do not forget to invoke service-myproject.bat
with both /user
and /password
options so that the service is allowed to cleanly stop your instance with granted administrative user.
不要忘记service-myproject.bat
同时使用/user
和/password
选项调用,以便服务可以使用授予的管理用户干净地停止您的实例。