8 Replies Latest reply on Jun 18, 2018 3:55 AM by phanik

    How to register JBoss6 as an auto-start windows service?

    chengwen

      hey ,all:

       

      After running services.bat ,  the serivce can be installed, but how to make it auto-start ? How to register it as an auto-start service?

       

      thanks in advance !

        • 1. Re: How to register JBoss6 as an auto-start windows service?
          jaikiran
          • 2. Re: How to register JBoss6 as an auto-start windows service?
            chengwen

            Thank you very much for your answer.

             

            I tried the way mentioned in http://community.jboss.org/message/547940#547940

             

            After I enter jbosssvc.exe -? in a command window, it shows:

             

             

            -------------------------------------------------------------------------------------------------------

            D:\JBOSS\jboss-6.0.0.Final\bin>jbosssvc.exe -?

            jbosssvc -- program for running batch files as services.

             

            Usage: jbosssvc -i       service service.bat

                            -i[wdcl]       service workingpath description comment service.bat

                            -u              service

                            -t               service

                            -s

            Options:

               -d   Service display name

               -c   Service description

               -w   Service working path

               -l     Turn info logging On

               -s    Sleep 1 second and exit

               -m   Start service manually

             

            -------------------------------------------------------------------------------------------------------

             

            The options doesn't contain "start service automaticlly".

            I tried "-a", it didn't work.

            I tried "-m", now I know it really means manually.

            I tried to install the service without options, it also means manually.

             

            Now I am totally confused.

             

            Or, the conclusion is : "I can not do this" ? I have to use the old "JavaSevice.exe" way?

            • 3. Re: How to register JBoss6 as an auto-start windows service?
              jaikiran

              Open the service.bat in a text editor. You'll notice this:

               

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

               

              Remove the "m" from the -imwdc options being passed to the jbosssvc.exe.

              • 4. Re: How to register JBoss6 as an auto-start windows service?
                chengwen

                Thank you very much !

                And sorry for my careless. I didn't notice that "-m" in service.bat.

                 

                Another question  , can I set other service that JBOSS6 depends on ?  mysql database sevice, for example.

                • 5. Re: How to register JBoss6 as an auto-start windows service?
                  jaikiran

                  Wen Cheng wrote:

                   

                   

                  And sorry for my careless. I didn't notice that "-m" in service.bat.

                  No problem!

                   

                   

                  Wen Cheng wrote:

                   

                  Another question  , can I set other service that JBOSS6 depends on ?  mysql database sevice, for example.

                  I'm not too sure about that. I haven't used Windows OS for a while now and don't know if you'll be able to set those dependencies via the Windows Service Manager in Control Panel. You might have to check the Windows documentation or knowledge base or wait for someone with Windows OS experience to answer your question.

                  • 6. Re: How to register JBoss6 as an auto-start windows service?
                    peterj

                    You can change the the startup options (set to autostart, or to manual) in the services control panel (its under Administrative Tools on my Win 7 system). Simply find the service in the list, look at its properties and there will be a Startup Type dialog box.

                     

                    You can make your service depend on other services by adding a DependOnService entry to your service. To do this, you will need to run regedit and go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services. Find the service and add a new string value named DependOnService entry. The value of this entry is a space-separated list of the services on which you want to depend. You must use the short name for the service in this list. One way of finding the short name is noting how the other service is listed in the registry. For example, on my machine MySQL appears in the registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MySQL. This makes the short name "MySQL", so that is what I would use as the value of DependOnService.

                     

                    If you need more details on this procedure, let me know.

                    1 of 1 people found this helpful
                    • 7. Re: How to register JBoss6 as an auto-start windows service?
                      chengwen

                      Thank you very much , I know how to do it now.

                       

                      P.S: If "jbosssvc.exe" contains a parameter to set dependency, it will become a little bit simpler .

                      • 8. Re: How to register JBoss6 as an auto-start windows service?
                        phanik

                        hi all,

                        I am using the same format to install the service and able to start successfully. when we stop the service from service manager(services.msc) or using command prompt 'net stop service name' , observed that service stopped but corresponding java processes are still running and able to login application webpage. This issue is happening on windows 2008 R2, please guide me how to resolve this issue.

                         

                         

                         

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

                        if not errorlevel 0 goto errExplain

                        echo Service %SVCDISP% installed

                        goto cmdEnd