poidasmith / winrun4j

WinRun4J Java Application Launcher
http://winrun4j.sourceforge.net
212 stars 63 forks source link

The service did start in a timely fashion, but the Java application is running. #82

Open lafual opened 6 years ago

lafual commented 6 years ago

Using Windows Server 2016 with Java 8 64bit. My Java class does not extend the WinRun4J classes and is a plain public static void main(String[]) with a ShutDownHook . INI has service.mode=false and both main.class and service.class refer to the same main.

When starting as a Window Service, the Java is run and I see the expected output in the logs. However, the Windows Service "Starting" progress bar remains open for about 15 seconds, then reports Error 1053: The service did not respond to the start or control request in a timely fashion. At which point, the EXE is stopped and Java ShutDownHook is run (this output is logged too).

It looks like WinRun4J is not reporting the started event to Windows.

bdw429s commented 5 years ago

@lafual Did you get this resolved? I am looking into winrunj as a replacement for launch4j specifically so I can create Windows services out of the binary without using a wrapper tool such as NSSM. Are you saying that the binaries produced by winrunj are not suitable to call directly via a windows service?

lafual commented 5 years ago

Hi. Received no update as to whether it is fixed. I evaluated most of what is available. I found Tanuki and JSL to be the best, in that an uncaught java exception will fail the service and cause a windows events. Yajsw and procrun are also ok, but they never fail the windows service, so you may never know that you have a problem. Winsw also looked promising, but seems to kill the jvm and not run the ShutdownHook

bdw429s commented 5 years ago

@lafual Wow, thanks for the run down. It will help me narrow the list.

lafual commented 5 years ago

You are welcome. A small correction about my comment on winsw; when you stop the windows service via sc or the gui, i think winsw gives the wrong kill to the jvm and the shutdown hook doesnt run. Tanuki is free for 32bit, not 64. So ended up using JSL from source forge.