4 Replies Latest reply on Jun 21, 2011 12:21 PM by Joe Wertz

    JBoss6 as a service with an alternate server configuration

    Joe Wertz Newbie

      Ok, so I'm beginning to feel stupid because I can't figure this out and it seems really simple.

       

      service.bat installs and runs the default server configuration.

       

      If I edit the run.bat file, I can make is run other server configurations. But if I do that, the JVM that is started stays after a shutdown and blocks the service from starting until that process is killed. This doesn't happen when running the default configuration.

       

      What's causing the JVM holdover? Do I need to change something in the shutdown.bat to tell it an alternate server configuration is being used?

        • 1. Re: JBoss6 as a service with an alternate server configuration
          Peter Johnson Master

          Joe, welcome to the JBoss forums!

           

          It is usually preferred to edit the service.bat file to make it start up alternate configurations - just edit the line that starts the server.

           

          As to stopping the server, that relies only on the hostname and the JNDI port for the the app server (it is completely independent of which configuration was started). As long as those are the defaults (localhost:1099) then no change is required. If you do change the defaults, then edit service.bat to pass the proper value to shutdown (using the -s parameter).

          • 2. Re: JBoss6 as a service with an alternate server configuration
            Joe Wertz Newbie

            Hey! Thanks ^_^

             

            I guess I'm still missing something. I didn't explain it exactly right the first time, sorry.

             

            I can change the 'service start' configuration in service.bat to start alternate configurations, that works fine, but that just runs the server as a service and doesn't install it.

             

            If I run 'service install', it doesn't actually start the server, so I can't add the '-c <configuration>' to it. 'net start <svcname>' starts the service once it's installed, but I can't give it an alternate configuration option, so I resorted to editting the run.bat file.

             

            I've seen other posts about using the Java Service Wrapper, so maybe I should be using that to install alternate server configurations? It just seems weird that, since 'service.bat install' will install the default configuration, it wouldn't have a method for installing alternate configurations.

            • 3. Re: JBoss6 as a service with an alternate server configuration
              Peter Johnson Master

              You need to make a copy of service.bat specific for your service and place the "-c xxx" into the copy. Then run the copy to install the service. If you want to run multiple services, there are also a number of other changes you will need to make in service.bat. I have already done that with my service.bat; to see the changes download the source code for JBoss in Action (http://www.manning.com/jamae) and look at jbia-src/ch15/src/service/windows/service.bat.

               

              The thing is that when you start the JBoss server, that fires up jbosssvc.exe and all it does is run service.bat (check out what 'install' does in service.bat). The biggest issue is that whoever wrote the service.bat file never gave a thought as to how it was to be used in a real environment; they just wrote enough to get it to work with minimal functionality.

              • 4. Re: JBoss6 as a service with an alternate server configuration
                Joe Wertz Newbie

                Ok, somehow I missed that the service start command 'net start <svcname>' called called 'service.bat start', so adding the '-c xxx' there would do what I wanted. I knew it was something stupid I didn't understand.

                 

                Thanks for being patient with a newbie.