I am using Wildfly 9
under both Ubuntu
an Windows
servers. Sometimes, I need to restart the servers but after I stop the server, I cannot start it again. There is a red message box saying Server start failed
. The detailed message is:
WFLYCTL0158: Operation handler failed: java.lang.IllegalStateException
I cannot stop Wildfly
because there is a bug on Windows preventing the user from stopping Wildfly server through Services. The process stucks at Stopping
but it never stops the Wildfly service. I have to restart Windows itself to make it work again.
Anyone facing this problem? How can I overcome this?
Here is how I got around the "stopping" issue. To kill the windows service without having to reboot windows, create a batch file call it killwindowsservice.bat or whatever. Put the following in it.
set SERVICE=%1
echo Killing Service %SERVICE%
FOR /F "tokens=3" %%A IN ('sc queryex %SERVICE% ^| findstr PID') DO (SET pid=%%A)
IF "!pid!" NEQ "0" (
taskkill /f /t /pid !pid!
)
Just call your script with the name of the windows service. So for me I call my Windows Services the name of my application server instance. So for eaxmple "Server01".
So for me I would call it like: killwindowsservice.bat Server01
And the script will kill the windows service.
The Windows service scripts that come with Wildfly 8.x+ DO NOT work on Windows 2012/2012 R2. I have not gotten them to work. I went and grabbed the jbosssvc.exe from a previous version of JBoss and customized the Windows Service scripts that come with it. And they work perfectly. I'm using these scripts on 12 Wildfly servers now without a problem.