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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 18:58:53  来源:igfitidea点击:

How to start WildFly as a service with standalone-full.xml?

windowsservicewildfly-8

提问by fatdevelops

WildFly provides a service.batin %WILDFLY_HOME%\bin\service. Calling the batch file with the installparameter installs WildFly as a service on Windows.

WildFly 提供了一个service.batin %WILDFLY_HOME%\bin\service. 使用install参数调用批处理文件会将 WildFly 作为服务安装在 Windows 上。

I have made changes to the standalone.confand need to use the standalone-full.xmlin 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 installregisters start command standalone.batwith no option.

将 WildFly 独立服务器作为 Windows 服务运行时,不带选项service install注册启动命令standalone.bat

By default, standalone.batloads standalone.conf.bat, and not standalone.confwhich is designed to Unix platforms.

默认情况下,standalone.bat加载standalone.conf.bat,而不是standalone.conf专为 Unix 平台设计的。

It is possible to load a specific standalone.conf.batfile setting environment variable STANDALONE_CONFwith its path. There, it is possible to set JAVA_OPTSoptions but not server options.

可以使用其路径加载特定的standalone.conf.bat文件设置环境变量STANDALONE_CONF。在那里,可以设置JAVA_OPTS选项,但不能设置服务器选项。

To avoid to edit WildFly release standalone.batfile, I recommend to create a copy of bin/service/service.batas bin/service/service-myproject.batwhere 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.batallows you to tune your service installation with SHORTNAME, DISPLAYNAMEand DESCRIPTIONvariables.

同时,此特定service-myproject.bat功能允许您使用SHORTNAMEDISPLAYNAMEDESCRIPTION变量来调整服务安装。

Do not forget to invoke service-myproject.batwith both /userand /passwordoptions so that the service is allowed to cleanly stop your instance with granted administrative user.

不要忘记service-myproject.bat同时使用/user/password选项调用,以便服务可以使用授予的管理用户干净地停止您的实例。