[
https://issues.redhat.com/browse/WFCORE-5092?page=com.atlassian.jira.plug...
]
Walter Raaflaub edited comment on WFCORE-5092 at 8/30/20 5:37 AM:
------------------------------------------------------------------
[~lvydra]
Hi Lukas,
Thanks for looking into the issue!
In point 5 of the steps to reproduce, I register the Windows service using the
"service.bat" script by Tom Fonteyne from the
"docs\contrib\scripts\service" directory (after copying this directory to
"bin"). That's probably the key issue. After understanding the above comment
by Bernhard Roider, I looked into the script.
I registered the service as follows:
run cmd as admin, cd to bin\service directory, then execute:
{code:java}
service install /startup /name my_keycloak_service /display my_keycloak_service /desc
"my keycloak service"
{code}
When I register the service using the above command, it actually executes the following:
{code:java}
"D:\basedir\keycloak\bin\service\amd64\wildfly-service" install
my_keycloak_service --DisplayName="my_keycloak_service" --Description="my
keycloak service" --LogLevel=INFO
--LogPath="D:\basedir\keycloak\standalone\log" --LogPrefix=service
--StdOutput=auto --StdError=auto --StartMode=exe --Startup=auto --StartImage=cmd.exe
--StartPath="D:\basedir\keycloak\bin"
++StartParams="/c#set#NOPAUSE=Y#&&#standalone.bat#-Djboss.server.base.dir=D:\basedir\keycloak\standalone#--server-config=standalone.xml"
--StopMode=exe --StopImage=cmd.exe --StopPath="D:\basedir\keycloak\bin"
++StopParams="/c jboss-cli.bat --connect --command=:shutdown" ++Environment=
{code}
Note that NOPAUSE=Y is added to the StartParams, but not to the StopParams.
When registered this way, the service behaves as described: it hangs when I try to stop
it.
From Bernhard Roider's comment I concluded that I should have registered the service
with the following command:
{code:java}
service install /startup /name my_keycloak_service /display my_keycloak_service /desc
"my keycloak service" /environment
"NOPAUSE=Y;JAVA_HOME=D:\basedir\java\jdk11"
{code}
I wonder whether NOPAUSE=Y should be added to the StopParams expression, or the
service.bat script should provide a default value for the environment parameter.
was (Author: wraaflaub):
[~lvydra]
Hi Lukas,
Thanks for looking into the issue!
In point 5 of the steps to reproduce, I register the Windows service using the
"service.bat" script by Tom Fonteyne from the
"docs\contrib\scripts\service" directory (after copying this directory to
"bin"). That's probably the key issue. After understanding the above comment
by Bernhard Roider, I looked into the script.
I registered the service as follows:
run cmd as admin, cd to bin\service directory, then execute:
service install /startup /name my_keycloak_service /display my_keycloak_service /desc
"my keycloak service"
When I register the service using the above command, it actually executes the following:
"D:\basedir\keycloak\bin\service\amd64\wildfly-service" install
my_keycloak_service --DisplayName="my_keycloak_service" --Description="my
keycloak service" --LogLevel=INFO
--LogPath="D:\basedir\keycloak\standalone\log" --LogPrefix=service
--StdOutput=auto --StdError=auto --StartMode=exe --Startup=auto --StartImage=cmd.exe
--StartPath="D:\basedir\keycloak\bin"
++StartParams="/c#set#NOPAUSE=Y#&&#standalone.bat#-Djboss.server.base.dir=D:\basedir\keycloak\standalone#--server-config=standalone.xml"
--StopMode=exe --StopImage=cmd.exe --StopPath="D:\basedir\keycloak\bin"
++StopParams="/c jboss-cli.bat --connect --command=:shutdown" ++Environment=
Note that NOPAUSE=Y is added to the StartParams, but not to the StopParams.
When registered this way, the service behaves as described: it hangs when I try to stop
it.
From Bernhard Roider's comment I concluded that I should have registered the service
with the following command:
service install /startup /name my_keycloak_service /display my_keycloak_service /desc
"my keycloak service" /environment
"NOPAUSE=Y;JAVA_HOME=D:\basedir\java\jdk11"
I wonder whether NOPAUSE=Y should be added to the StopParams expression, or the
service.bat script should provide a default value for the environment parameter.
Windows Service cannot be stopped when using custom JAVA_HOME path
------------------------------------------------------------------
Key: WFCORE-5092
URL:
https://issues.redhat.com/browse/WFCORE-5092
Project: WildFly Core
Issue Type: Bug
Components: Scripts
Affects Versions: 11.0.0.Final
Reporter: Walter Raaflaub
Assignee: Lukas Vydra
Priority: Major
I am running keycloak in a Wildfly container as a Windows service on Windows Server 2019.
The service starts up and works correctly; but it hangs when I try to stop it.
There is no global JAVA_HOME environment variable defined on the server; I'm using a
custom JAVA_HOME path that I have configured in standalone.conf.bat.
While stopping, the service issues the following warning in stdout.log:
{noformat}
JAVA_HOME is not set. Unexpected results may occur.
Set JAVA_HOME to the directory of your local JDK to avoid this message.
Drcken Sie eine beliebige Taste . . .
{noformat}
(Drücken Sie eine beliebige Taste . . . = German vor "Press any key ...")
It seems that when stopping the service, the JAVA_HOME setting is not correctly passed to
the jboss-cli.bat script. The script seems to be waiting for user input, which is akward
in a Windows service. That means that also the NOPAUSE setting is not passed correctly to
the jboss-cli.bat script.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)