Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-5092

Windows Service cannot be stopped when using custom JAVA_HOME path

XMLWordPrintable

    • Hide

      Wildfly Windows service cannot be stopped

      1. install JDK to a custom path, e.g. D:\basedir\java\jdk11
      2. verify: no global JAVA_HOME environment variable
      3. install Wildfly
      4. set JAVA_HOME path in standalone.conf.bat (line 35): set "JAVA_HOME=D:\basedir\java\jdk11"
      5. register Wildfly as Windows service
      6. start Windows service
      7. stop Windows service
      8. verify contents of stoud.log:
      2020-05-28 21:42:54 Commons Daemon procrun stdout initialized
      Calling "D:\basedir\keycloak-10.0.1\bin\standalone.conf.bat"
      
      Setting JAVA property to "D:\basedir\java\jdk11\bin\java"
      
      ===============================================================================
      
      
      
        JBoss Bootstrap Environment
      
      
      
        JBOSS_HOME: "D:\basedir\keycloak-10.0.1"
      
      
      
        JAVA: "D:\basedir\java\jdk11\bin\java"
      
      
      
        JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman  --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED"
      
      
      
      ===============================================================================
      
      
      
      21:43:01,439 INFO  [org.jboss.modules] (main) JBoss Modules version 1.10.0.Final
      
      21:43:04,399 INFO  [org.jboss.msc] (main) JBoss MSC version 1.4.11.Final
      
      21:43:04,414 INFO  [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final
      
      21:43:04,649 INFO  [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: Keycloak 10.0.1 (WildFly Core 11.1.1.Final) starting
      
      ...
      
      21:43:24,646 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 10.0.1 (WildFly Core 11.1.1.Final) started in 28567ms - Started 591 of 889 services (606 services are lazy, passive or on-demand)
      
      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 . . . 
      
      
      Show
      Wildfly Windows service cannot be stopped install JDK to a custom path, e.g. D:\basedir\java\jdk11 verify: no global JAVA_HOME environment variable install Wildfly set JAVA_HOME path in standalone.conf.bat (line 35): set "JAVA_HOME=D:\basedir\java\jdk11" register Wildfly as Windows service start Windows service stop Windows service verify contents of stoud.log: 2020-05-28 21:42:54 Commons Daemon procrun stdout initialized Calling "D:\basedir\keycloak-10.0.1\bin\standalone.conf.bat" Setting JAVA property to "D:\basedir\java\jdk11\bin\java" =============================================================================== JBoss Bootstrap Environment JBOSS_HOME: "D:\basedir\keycloak-10.0.1" JAVA: "D:\basedir\java\jdk11\bin\java" JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED" =============================================================================== 21:43:01,439 INFO [org.jboss.modules] (main) JBoss Modules version 1.10.0.Final 21:43:04,399 INFO [org.jboss.msc] (main) JBoss MSC version 1.4.11.Final 21:43:04,414 INFO [org.jboss.threads] (main) JBoss Threads version 2.3.3.Final 21:43:04,649 INFO [org.jboss.as] (MSC service thread 1-2) WFLYSRV0049: Keycloak 10.0.1 (WildFly Core 11.1.1.Final) starting ... 21:43:24,646 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: Keycloak 10.0.1 (WildFly Core 11.1.1.Final) started in 28567ms - Started 591 of 889 services (606 services are lazy, passive or on-demand) 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 . . .
    • User Experience
    • Workaround Exists
    • Hide

      Define JAVA_HOME not only in standalone.conf.bat, but also in jboss-cli.bat (add a line set "JAVA_HOME=<custom path>" ).

      Show
      Define JAVA_HOME not only in standalone.conf.bat, but also in jboss-cli.bat (add a line set "JAVA_HOME= <custom path> " ).

      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:

      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 . . . 
      

      (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.

              lvydra Lukas Vydra
              wraaflaub Walter Raaflaub (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: