I have a Java application that will need to run as a Windows service. For this I created a nssm install file and run the java application using that. Everything is fine in Windows 7 but when running the service in Windows 01 we are getting errors.
Errors that are thrown in Windows 1 are:
- Error attaching to console for service XXX, AttachConsole()- failed: Access is denied.
- Failed to terminate process with PID Xfoe service XXX: Access is denied.
- Failted to open process handle for process with PID X when terminating service XXX: The parameter is incorrect.
We are using nssm 2.24-101 (pre-release).
The installation script looks like:
@echo off
set SERVICE=XXX
set SERVICEDESCRIPTION=XXXX
set INSTALLATIONPATH=C:\Services\XXX
set JAVAPARAMETERS=-jar XXX.jar
set NSSM=%INSTALLATIONPATH%\nssm\nssm.exe
set JAVAPATH=%INSTALLATIONPATH%\jre
call:registerservice
call:startservice
goto end
:registerservice
echo Registering service %SERVICE%
"%NSSM%" install %SERVICE% "%JAVAPATH%"
"%NSSM%" set %SERVICE% Application "%JAVAPATH%\bin\java.exe"
"%NSSM%" set %SERVICE% AppDirectory "%INSTALLATIONPATH%"
"%NSSM%" set %SERVICE% AppParameters %JAVAPARAMETERS%
"%NSSM%" set %SERVICE% DisplayName %SERVICE%
"%NSSM%" set %SERVICE% Description %SERVICEDESCRIPTION%
"%NSSM%" set %SERVICE% Start SERVICE_AUTO_START
goto:eof
:startservice
echo Starting %SERVICE%
"%NSSM%" start %SERVICE%
if ERRORLEVEL 1 sc start %SERVICE%
goto:eof
Can someone help me out to fix this problem?
Didn't find any solution for this. I remove nssm from my application and replaced it by Apache Commons Daemon.