1 2 Previous Next 20 Replies Latest reply on Aug 11, 2010 1:16 PM by peterj

    2 instances on same jBoss installation

    prashant.ladha

      Hi,


      I am using jboss-5.1.0.GA

       

      I need to have 2 instances running on 2 different port number (8080 and 8088) on the same jBoss installation.

      Can you please guide me how can we do that ?

       

      I have to deploy 1 webservices on each instance.

      So that restarting one instance would not affect the availability of the other instance.

       

      Need your help in identifying the files that needs to be modified.

      I got a suggestion from someone saying the if we replicate server directory and modify the 8080 to 8088 and also copy the run.sh and configure the new run.sh to refer server1 folder instead of server folder to use those configuration.

       

      Please let me know if you have any ideas or a documentation that I can refer to.

       

       

      -- Prashant.

        • 1. Re: 2 instances on same jBoss installation
          jaikiran
          • 2. Re: 2 instances on same jBoss installation
            prashant.ladha

            I havent worked on jBoss ever, this is the first time, I am trying something on jBoss server.

            With this background, I tried my best to make sense of the documentation, but I was not able to get the what I was looking for.

             

             

            -- Prashant.

            • 3. Re: 2 instances on same jBoss installation
              erasmomarciano

              Is not difficult

              Try

               

              1) Make a copy of the directory all

              2) Make two script of start end stop

              3) Modify this file xml conf/bootstrap.xml you see here this url http://community.jboss.org/wiki/AS5ServiceBindingManager

               

              Warning Point 3 should be applied only in a istance

              • 4. Re: 2 instances on same jBoss installation
                brian.stansberry
                • 5. Re: 2 instances on same jBoss installation
                  prashant.ladha

                  Hi,

                   

                  Thanks erasmo for the idea but I have a few questions on that (mentioned in blue).

                   

                  1) Make a copy of the directory all

                           I will make a copy of /usr/lib/jboss/jboss-5.1.0.GA/server/all as /usr/lib/jboss/jboss-5.1.0.GA/server/all2

                  2) Make two script of start end stop

                         We already have startJboss.sh which calls run.sh,  now how, where and what do I modify to make the new run.sh to use the all2 and allow the existing run.sh to use the all folder?

                  3) Modify this file xml conf/bootstrap.xml you see here this url http://community.jboss.org/wiki/AS5ServiceBindingManager

                         I couldnt find any entry in bootstrap.xml which the port number is mentioned.

                   

                   

                   

                  -- Prashant.

                  • 6. Re: 2 instances on same jBoss installation
                    peterj

                    "I couldnt find any entry in bootstrap.xml which the port number is mentioned."

                     

                    The file with the port numbers has been playing musical chairs and each release it has a new name and is in a new location. Trying to figure out where the port numbers will be in each release is one of the fun aspects of working with JBoss AS.

                     

                    Anyway, in 5.1.0 the port numbers are in server/xxx/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml.

                     

                    But as an aside, do you really want the second HTTP port to be 8088? The bindings-jboss-beans.xml is set up to easily provide an alternate HTTP port of 8180 - all you have to do it start the second app server with the option "-Djboss.service.binding.set=ports-01".

                     

                    If you really must have 8088, you will have to change all of the ports that are defined in that file, not just 8080.

                    1 of 1 people found this helpful
                    • 7. Re: 2 instances on same jBoss installation
                      brian.stansberry
                      Yeah, the file does jump around a lot.   And it will probably move again in AS 6.  Ultimately all the end-user configuration aspects of the entire server need to be put into a single file. That won't happen in AS 6.0 though.
                      • 8. Re: 2 instances on same jBoss installation
                        brian.stansberry
                        O.T. Peter, if you get a moment could you contact me privately at brian dot stansberry at jboss dot com?
                        • 9. Re: 2 instances on same jBoss installation
                          prashant.ladha

                          Hi Peter,

                           

                          Thanks for your help.

                           

                          I will repeat my understanding.

                           

                          To run 2 jBoss application server instances on the same jBoss installation, I can allow the existing 8080 implementation to run as it is. And modify the run.sh to include "-Djboss.service.binding.set=ports-01". This would allow to start another jboss at 8180.

                           

                          But still, I actually want to run different set of webservices on both these instances. e.g. only XYZ  webservice running on application server A (porT:8080) and only ABC webservices running on application server B (port:8180).

                          how and where do I configure which webservices this particular jBoss instance would host?

                           

                           

                          -- Prashant.

                          • 10. Re: 2 instances on same jBoss installation
                            peterj

                            That is simple. You earlier said you copied "server/all" as "server/all2". Deploy to server/all/deploy the web service you want available at 8080 and deploy to server/all2/deploy the web service you want avaliable at 8180.

                             

                            By the way, if you do not intend to run a cluster, you should probably instead copy "server/default" as "server/default2", the 'all' config assumes you will be clustering so running both 'all' and 'all2' could cause an issue if you did not want clustering.

                            • 11. Re: 2 instances on same jBoss installation
                              prashant.ladha

                              Heres what I have done so far:
                              1. copied bin/run.sh as runXYZ.sh
                              2. copied bin/run.conf as runXYZ.conf
                              3. copied server/default as server/defaultXYZ
                              4. modified runXYZ.conf to include the below line

                              JAVA_OPTS="$JAVA_OPTS -Djboss.service.binding.set=ports-01"

                              5. modified runXYZ.sh to use runXYZ.conf

                              # Read an optional running configuration file
                              if [ "x$RUN_CONF" = "x" ]; then
                                  RUN_CONF="$DIRNAME/runQAA.conf"
                              fi
                              # Read an optional running configuration file
                              if [ "x$RUN_CONF" = "x" ]; then
                                  RUN_CONF="$DIRNAME/runXYZ.conf"
                              fi


                              But here, I got a few questions.
                              1. where do I configure the runXYZ.sh to not look at default and instead look at server/defaultXYZ only.
                              And vice versa i.e. 8080 only should only load the webservices configured at server/default.

                              2. if I dont use -c parameters, from which folder it would pick up the configs?

                              • 12. Re: 2 instances on same jBoss installation
                                peterj

                                     " where do I configure the runXYZ.sh to not look at default and instead look at server/defaultXYZ only"

                                 

                                That is what the -c option is for. You can add it to the runXYZ.sh file, to the lines that start up the app server (near the end of the file):

                                 

                                      "$JAVA" $JAVA_OPTS \
                                         -Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
                                         -classpath "$JBOSS_CLASSPATH" \
                                         org.jboss.Main -c defaultXYZ "$@"

                                 

                                By the way, I would not have copied run.sh nor run.conf. Instead, I would have created a runXYZ.sh file with these statements:

                                 

                                # !/bin/sh

                                    run.sh -c defaultXYZ -Djboss.service.binding.set=ports-01

                                 

                                If you chaage run.conf and run.sh, or copies of those files, each time a new release comes out you will have to resolve that changes in those files with your modified ones. By placing all of your changes in another file, you have localized your changes and can use the updated files without having to merge any changes. Note that the main JBoss AS class understand -D options and set the system properties for you.

                                 

                                Theo ther thing I would do is not run 'defaut'. Instead, I would make a second copy of server/default as server/defaultABC and then create a runABC.sh file with:

                                 

                                # !/bin/sh

                                    run.sh -c defaultABC
                                • 13. Re: 2 instances on same jBoss installation

                                  Hello,

                                   

                                  I have configured two instances of jBoss on the same server. Now I want to stop one instance at a time. For the purpose I intend to have two  different stop-jboss scripts. Can anyone please help me how to handle this. Thanks.

                                  • 14. Re: 2 instances on same jBoss installation
                                    peterj

                                    Use shutdown.sh or shutdown.bat to stop the servers. The only info you need is the host name and JNDI port number (1099 by default):

                                     

                                    shutdown -s localhost:1099

                                     

                                    That works for the first server. For the second, replace the 1099 with the JNDI port for that server.

                                    1 2 Previous Next