简体   繁体   中英

Running bat file for java web application as Windows Service giving error

I have a heavy java web application that has a module which needs to be run as soon as computer starts and 24X7. That module has a bat file to execute which fetches data from server. I want to run that bat file as a windows service on my system (OS: Windows 7) I created service with sc create command which successfully created. But when I try to start it, it always give error 1053 ie can't start service ; service does not respond correctly or in timely manner. I followed all the related threads on stack overflow and others as well but no luck.For eg., I set servicesPipeTimeout also but it doesn't work.

Is there a way in java itself to create windows service?

I do not want to use any third party like wrapper, NSSM etc or Time Scheduler either.

Please provide me some clues if anybody faced this error and get it resolved.

Thanks in advance.The time you give means a lot to me. Thanks a lot

What you are trying will not work. While SC will not tell you otherwise, it should only be used to install a binary executable that is already a "true" windows service. Because the batch file does not implement the windows services interface, it fails with error 1053 ("The service did not respond to the start or control request in timely fashion") when you try to start the service.

To start your batch file as a service, use a "service wrapper" -- an executable that implements the windows services interface and can launch your batch file when you start the service. Microsoft's SRVANY is free and basic, but there are also commercial applications more suitable for a professional environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM