Menu

#4 Service can not be stopped

v1.0 (example)
closed
nobody
None
5
2015-12-08
2015-11-18
No

In Janel 4.1.0 a java program installed as a service can not be stopped/uninstalled any more. The static method initiateExit in the main class is no longer called and so the program is not informed about the stopping request.
This worked in the former version 4.0.4.
We are working with 32 bit java 1.8.0_60 on Windows 7 machines here.

You will find a configuration file for the service as an attachment.

1 Attachments

Discussion

  • Timothy Kil

    Timothy Kil - 2015-11-23

    Hi Roland,

    Please use Janel 4.0.4 until this is resolved.

    Thanks,
    Tim

     
  • Timothy Kil

    Timothy Kil - 2015-11-29

    Thank you John! Your changes are in Janel 4.1.1.

    Thank you Roland for reporting this! Let us know if Janel 4.1.1 does not fix the issues you experienced.

    Tim

     
  • Roland Schaeuble

    I tried Janel 4.1.1. Now the service can be installed, but not started. I did the following:

    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --install
    C:\TEMP\CORECUSTOMER>sc start wms_coreserver
    [SC] StartService FEHLER 1053:

    Der Dienst antwortete nicht rechtzeitig auf die Start- oder Steuerungsanforderung.

    Which means:
    Error 1053: The service did not respond to the start or control request in a timely fashion

    Replaced the executable with the one from janel-4.0.4 everything works fine.

    The configuration (coreserver_service.lap) is still the same as in the original post, but now I uncommented the line containing the WMS_JAVA_HOME environment variable and set the environment variable to the correct path.

     
  • Timothy Kil

    Timothy Kil - 2015-12-01

    Hi Roland,

    I have three tests that I ran with 4.1.1 which start a Windows service and write out to a file. All three tests ran successfully. Have you tried starting any other Windows services with Janel than the current one you have issues with? In the Janel zip file I have TestLaunch046.java, TestLaunch047.java and TestLaunch048.java that can be used as Windows services, if you would like to try one of these out to see if it can be started. I would recommend trying TestLaunch048 first, it runs for 2 minutes before stopping by itself.

    Tim

     
  • Roland Schaeuble

    Hi Timothy,

    I did some more experiments. The problem seems to be related to the janel.java.home_path property in conjunction with an environment variable.

    My .lap file contains the following line:
    janel.java.home.path=${env.WMS_JAVA_HOME}

    I found out the following:

      • If I set the environment variable WMS_JAVA_HOME in the Windows system control panel, everything works fine. The service can be installed, started, stopped and uninstalled correctly (see Session 1 log).
    1. If I set the environment variable WMS_JAVA_HOME at the command line, The service can be installed, and uninstalled, but not started (see Session 1 log). This behavior is different in janel 4.0.4 (maybe a fallback to an appropriate java version or the environment variable has been evaluated during installation of the service?).

    2. If I comment out the janel.java.home.path, everything works fine. The service can be installed, started, stopped and uninstalled correctly (see Session 3 log)

    3. If I replace the environment variable in the .lap file by a fixed path (janel.java.home.path=C:\Program Files (x86)\Java\jdk1.8.0_60janel.min.java.version=1.8), everything works fine (see Session 4 log).

    Session 1 log (WMS_JAVA_HOME set in System Control Panel):

    C:\TEMP\CORECUSTOMER>echo %WMS_JAVA_HOME%
    C:\Program Files (x86)\Java\jdk1.8.0_60
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --install
    
    C:\TEMP\CORECUSTOMER>sc start wms_coreserver
    
    SERVICE_NAME: wms_coreserver
            TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
            STATE              : 4  RUNNING
                                    (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
            WIN32_EXIT_CODE    : 0  (0x0)
            SERVICE_EXIT_CODE  : 0  (0x0)
            CHECKPOINT         : 0x0
            WAIT_HINT          : 0x0
            PID                : 6336
            FLAGS              :
    
    C:\TEMP\CORECUSTOMER>sc stop wms_coreserver
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --uninstall
    
    C:\TEMP\CORECUSTOMER>
    

    Session 2 log (WMS_JAVA_HOME set from command line):

    C:\TEMP\CORECUSTOMER>java -version
    java version "1.8.0_60"
    Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
    Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
    
    C:\TEMP\CORECUSTOMER>set WMS_JAVA_HOME=%JAVA_HOME%
    
    C:\TEMP\CORECUSTOMER>echo %WMS_JAVA_HOME%
    C:\Program Files (x86)\Java\jdk1.8.0_60
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --install
    
    C:\TEMP\CORECUSTOMER>sc start wms_coreserver
    [SC] StartService FEHLER 1053:
    
    Der Dienst antwortete nicht rechtzeitig auf die Start- oder Steuerungsanforderung.
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --uninstall
    
    C:\TEMP\CORECUSTOMER>
    

    Session 3 log (janel.jave.home.path commented out):

    C:\TEMP\CORECUSTOMER>java -version
    java version "1.8.0_60"
    Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
    Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode)
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --install
    
    C:\TEMP\CORECUSTOMER>sc start wms_coreserver
    
    SERVICE_NAME: wms_coreserver
            TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
            STATE              : 4  RUNNING
                                    (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
            WIN32_EXIT_CODE    : 0  (0x0)
            SERVICE_EXIT_CODE  : 0  (0x0)
            CHECKPOINT         : 0x0
            WAIT_HINT          : 0x0
            PID                : 8224
            FLAGS              :
    
    C:\TEMP\CORECUSTOMER>sc stop wms_coreserver
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --uninstall
    
    C:\TEMP\CORECUSTOMER>
    

    Session 4 log (Fixed path instead of environment variable):

    C:\TEMP\CORECUSTOMER>java -version
    java version "1.8.0_60"
    Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
    Java HotSpot(TM) Client VM (build 25.60-b23, mixed mode, sharing)
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --install
    
    C:\TEMP\CORECUSTOMER>sc start wms_coreserver
    
    SERVICE_NAME: wms_coreserver
            TYPE               : 110  WIN32_OWN_PROCESS  (interactive)
            STATE              : 4  RUNNING
                                    (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
            WIN32_EXIT_CODE    : 0  (0x0)
            SERVICE_EXIT_CODE  : 0  (0x0)
            CHECKPOINT         : 0x0
            WAIT_HINT          : 0x0
            PID                : 8676
            FLAGS              :
    
    C:\TEMP\CORECUSTOMER>sc stop wms_coreserver
    
    C:\TEMP\CORECUSTOMER>bin\coreserver_service.exe --uninstall
    
    C:\TEMP\CORECUSTOMER>
    

    Don't know if this behavior is intended and if you regard this as a bug or not. Anyway, I would prefer to set the environment variable in a start-script (Batch-File) instead of depend on a system-wide setting.

    Thank you very much for your help and work so far.

     
  • Timothy Kil

    Timothy Kil - 2015-12-06

    Hi Roland,

    You are going to need to use a system-wide environment variable for your service to start. Since an environment variable set at the command prompt disappears for that user as soon as the command prompt disappears, and starting a service could happen from any command prompt and from the Windows service management console - and a Janel Windows service refers to the .lap file for starting and stopping at start and stop time, it really has to be a system-wide environment variable.

    Tim

     
  • Roland Schaeuble

    Hi Tim,
    Thats understandable and OK for me. IMHO You can close this bug now.Thank you very much.

     
  • Timothy Kil

    Timothy Kil - 2015-12-08

    You're welcome!

    Tim

     
  • Timothy Kil

    Timothy Kil - 2015-12-08
    • status: open --> closed