2 Replies Latest reply on Jul 13, 2015 8:21 AM by nicolas.santisteban

    JBoss does not start as service

    nicolas.santisteban

      Hi. (First, excuse me if my question does not have to be in this forum)

       

      I'm using JBoss 7.2 as Domain mode and I cannot start it as Windows Service. The only way to start the JBoss is executing the domain.bat, but sometimes the cmd console that domain.bat opens get close and the only solution is fix the service. This is my service.bat:

       

      @echo off

      REM JBoss, the OpenSource webOS

      REM

      REM Distributable under LGPL license.

      REM See terms of license at gnu.org.

      REM

      REM -------------------------------------------------------------------------

      REM JBoss Service Script for Windows

      REM -------------------------------------------------------------------------

       

       

      @if not "%ECHO%" == "" echo %ECHO%

      @if "%OS%" == "Windows_NT" setlocal

      set DIRNAME=%CD%

       

      REM

      REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated

      REM during the build with ant filter.

      REM

      set SVCNAME=ForestBPMS

      set SVCDISP=Forest BPMS

      set SVCDESC=Servicio JBoss72 - FOREST BPMS

      set NOPAUSE=Y

       

      REM Suppress killing service on logoff event

      REM set JAVA_OPTS=-Xrs -Xms256M -Xmx512M -XX:MaxPermSize=256m

       

      REM Figure out the running mode

       

      if /I "%1" == "install"   goto cmdInstall

      if /I "%1" == "uninstall" goto cmdUninstall

      if /I "%1" == "start"     goto cmdStart

      if /I "%1" == "stop"      goto cmdStop

      if /I "%1" == "restart"   goto cmdRestart

      if /I "%1" == "signal"    goto cmdSignal

      echo Usage: service install^|uninstall^|start^|stop^|restart^|signal

      goto cmdEnd

       

      REM jbosssvc retun values

      REM ERR_RET_USAGE           1

      REM ERR_RET_VERSION         2

      REM ERR_RET_INSTALL         3

      REM ERR_RET_REMOVE          4

      REM ERR_RET_PARAMS          5

      REM ERR_RET_MODE            6

       

      :errExplain

      if errorlevel 1 echo Invalid command line parameters

      if errorlevel 2 echo Failed installing %SVCDISP%

      if errorlevel 4 echo Failed removing %SVCDISP%

      if errorlevel 6 echo Unknown service mode for %SVCDISP%

      goto cmdEnd

       

      :cmdInstall

      jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service-AS7_domain.bat

      if not errorlevel 0 goto errExplain

      echo Service %SVCDISP% installed

      goto cmdEnd

       

      :cmdUninstall

      jbosssvc.exe -u %SVCNAME%

      if not errorlevel 0 goto errExplain

      echo Service %SVCDISP% removed

      goto cmdEnd

       

      :cmdStart

      REM Executed on service start

      del .ServicioForest.lock 2>&1 | findstr /C:"being used" > nul

      if not errorlevel 1 (

        echo Could not continue. Locking file already in use.

        goto cmdEnd

      )

      echo Y > .ServicioForest.lock

      jbosssvc.exe -p 1 "Starting %SVCDISP%" > run.log

      call domain.bat < .ServicioForest.lock >> ForestServicioJB7.log 2>&1

      REM call domain.bat

      jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run.log

      del .ServicioForest.lock

      goto cmdEnd

       

      :cmdStop

      REM Executed on service stop

      echo Y > .s.lock

      jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown.log

      call jboss-admin.bat --connect command=:shutdown >> shutdown.log 2>&1

      jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown.log

      del .s.lock

      goto cmdEnd

       

      :cmdRestart

      REM Executed manually from command line

      REM Note: We can only stop and start

      echo Y > .s.lock

      jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >> shutdown.log

      call jboss-admin.bat --connect command=:shutdown >> shutdown.log 2>&1

      del .s.lock

      :waitRun

      REM Delete lock file

      del .ServicioForest.lock > nul 2>&1

      REM Wait one second if lock file exist

      jbosssvc.exe -s 1

      if exist ".ServicioForest.lock" goto waitRun

      echo Y > .ServicioForest.lock

      jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> run.log

      call domain.bat < .ServicioForest.lock >> ForestServicioJB7.log 2>&1

      jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run.log

      del .ServicioForest.lock

      goto cmdEnd

       

      :cmdSignal

      REM Send signal to the service.

      REM Requires jbosssch.dll to be loaded in JVM

      @if not ""%2"" == """" goto execSignal

      echo Missing signal parameter.

      echo Usage: service signal [0...9]

      goto cmdEnd

      :execSignal

      jbosssvc.exe -k%2 %SVCNAME%

      goto cmdEnd

       

      :cmdEnd

       

       

      I installed it using "service install" and it installed correctly then I started using "service start" but it does not start too. And when I start it from the services.msc it does not start too

       

      Thanks

        • 1. Re: JBoss does not start as service
          steelhand900

          Hello Nicolas Santisteban,

           

          What appears in the log for you?

           

          Regards

          • 2. Re: JBoss does not start as service
            nicolas.santisteban

            Hi Jean Carlos

             

            The problem cannot appear because the JBoss never start as service. But when I start with the domain.bat. That CMD suddenly closes anytime. When it get close the message that appears in the log is:

             

            ERROR [org.jboss.remoting.remote.connection] (Remoting "server1" read-1) JBREM000200: Remote connection failed: java.io.IOException: Se ha forzado la interrupción de una conexión existente por el host remoto

             

            Wich in English means: Remote connection failed: java.io.IOException: An existing connection was forcibly closed by the remote host