[jboss-jira] [JBoss JIRA] (WFLY-13537) Windows Service cannot be stopped when using custom JAVA_HOME path

Bernhard Roider (Jira) issues at jboss.org
Fri Jun 5 02:25:00 EDT 2020


    [ https://issues.redhat.com/browse/WFLY-13537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14138224#comment-14138224 ] 

Bernhard Roider commented on WFLY-13537:
----------------------------------------

A better solution should be the use of the ++Environment flag.

set SERVICE_ENV=NOPAUSE=Y;JAVA_HOME=%JAVA_DIR%;JBOSS_HOME=%JBOSS_HOME%;JBOSS_LOG_DIR=%LOGPATH%;JBOSS_BASE_DIR=%BASE%

%PRUNSRV% install %SHORTNAME% %RUNAS% --DisplayName=%DISPLAYNAME% --Description="%DESCRIPTION%" ^
 --LogLevel=%LOGLEVEL% --LogPath=%LOGPATH% --LogPrefix=service ^
 --StdOutput=%STDOUT% --StdError=%STDERR% ^
 --StartMode=exe --Startup=%STARTUP_MODE% --StartImage=cmd.exe --StartPath=%START_PATH% ++StartParams=%STARTPARAM% ^
 --StopMode=exe --StopImage=cmd.exe --StopPath=%STOP_PATH%  ++StopParams=%STOPPARAM% ^
 --PidFile=jboss-service-pid ++Environment=%SERVICE_ENV%

> Windows Service cannot be stopped when using custom JAVA_HOME path
> ------------------------------------------------------------------
>
>                 Key: WFLY-13537
>                 URL: https://issues.redhat.com/browse/WFLY-13537
>             Project: WildFly
>          Issue Type: Bug
>          Components: Scripts
>    Affects Versions: 11.0.0.Final
>            Reporter: Walter Raaflaub
>            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.
> Drcken 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)



More information about the jboss-jira mailing list