12 Replies Latest reply on Mar 4, 2010 11:54 AM by Peter Johnson

    Do I need to restart JBoss??

    Steve Foubister Newbie

      Hi there


      This is my first posting so please let me know if I am in the wrong place.


      I am a sysadmin at work and am responsible for deploying updates to our java applications running through jboss. I have just finished an Admin course for JBoss to gain an insight into how it works and best practices etc. On the course we were taught that we can hot-undeploy and -deploy applications.


      I have just deployed an update to one of our apps as provided by our developers and I am now having an argument with him as he is saying that we need to shutdown jboss, delete the data, tmp, work and log directories(!!) then restart the jboss server just so we can release the update.


      Now, I tailed the server.log as I was deploying the updates and jboss correctly undeployed and redeployed the updates.


      However, the dev is saying the following:


      "static variables loaded on the memory gets stuck and that the unified class loader does not always work especially if there's variables on the heap"


      Is he taslking a load of *beep* or is he to be believed?


      Is this due to poor coding and the GC not being implemented properly or am I missing something more fundamental with the way JBoss works and deploys applications?


      Thanks to anyone who can shed light on this as I think we need an overhaul in the way we work with jboss.





        • 1. Re: Do I need to restart JBoss??
          jaikiran pai Master

          Steve, welcome to the forums.


          JBoss AS user forum is a better place for this question. I'll move this thread there.

          • 2. Re: Do I need to restart JBoss??
            Peter Johnson Master

            In a way, you are both correct. Let me explain. When you overwrite an app with a new version, JBoss AS will automatically undeploy the old version and deploy the new version. From that point on all of the users of the app will be using the new version. So a restart is not necessary from the user's point of view.


            However, there are often problems with deallocating all of the data structures used by the older version of the app. Which means that they will stay around using up both heap and permgen space. The only guaranteed way of getting this old stuff cleaned out is to restart the server.


            In general, in a production environment, redeploying an application is a rare event happening maybe once a month or less. In that case, there is no real need to restart the app server immediately. Instead, you can wait until a quite time (evening or weekend) to schedule a restart. If, however, you udpate the app several times a day (I sure hope not!) then you will want to reboot more often (daily or twice a day).

            1 of 1 people found this helpful
            • 3. Re: Do I need to restart JBoss??
              Steve Foubister Newbie

              Thanks for your response Peter.


              That's both good and bad news as we tend to have updates to our production servers between1-2 times a week and have multiple applications under many of our jboss servers.


              Is it possible to restart a particular instance rather than having to restart the whole jboss server? I found this code in a script which seem to use jnp and the port number but I do not really understand what jnp is. I tried reading/understanding this document (http://community.jboss.org/wiki/namingcontextfactory) but it did not really make a lot of sense to me. Where are those ports defined? What are they for?


                      echo -n "Gracefully Stopping instances$2: "
                      case "$2" in
                         $JBOSS_HOME/bin/shutdown.sh -s jnp://
                         $JBOSS_HOME/bin/shutdown.sh -s jnp://
                         $JBOSS_HOME/bin/shutdown.sh -s jnp://
                         $JBOSS_HOME/bin/shutdown.sh -s jnp://
                         $JBOSS_HOME/bin/shutdown.sh -s jnp://
                         $JBOSS_HOME/bin/shutdown.sh -s jnp://






              • 4. Re: Do I need to restart JBoss??
                Peter Johnson Master

                "jnp" is the protocol used by the JNDI service within JBoss AS. The URL is passed to shutdown.sh so that it knows which server to communicate with.

                Are the various AS instancs running within a cluster? If so, you should be able to reboot them one at a time. It might be best to wait a few minutes between shutdown and startup to let the cluster adjust itself after loosing a node (instance), and then wait for it to reestablish the rebooted node before cylcing the next node.

                • 5. Re: Do I need to restart JBoss??
                  Steve Foubister Newbie

                  Thanks Peter


                  However, where are these jnp ports configured? Are they assigned at runtime? If so how can they be predefined in a shutdown script?


                  One of the developers has said you can find it in the bindings.xml file. However, I cannot for the life of me work out how the ports are defined. I have even tried to do a 'find' from the jboss directory and it returns nothing.





                  • 7. Re: Do I need to restart JBoss??
                    Peter Johnson Master
                    What version of JBoss AS are you using? I would hate to spend a lot of time explaining what is done in JBoss AS 5.x just to find out you are using 4.2.3!
                    • 8. Re: Do I need to restart JBoss??
                      Steve Foubister Newbie

                      We are using a combination of versions from 3.2.5 up to 4.2.3.


                      The script that I took the extract from above is on a system using 3.2.5.

                      • 9. Re: Do I need to restart JBoss??
                        Peter Johnson Master

                        I don't have any 3.2.x version sitting around any more, so I would not know about them. But for 4.0.x and 4.2.x there is a sample bindings file at docs/examples/binding-manager/sample-bindings.xml. Within that file, this entry is for the JNDI port (used by the jnp: protocol):


                              <service-config name="jboss:service=Naming"
                                 <delegate-config portName="Port" hostName="BindAddress">
                                    <attribute name="RmiPort">1098</attribute>
                                 <binding port="1099" host="${jboss.bind.address}"/>
                        • 10. Re: Do I need to restart JBoss??
                          Peter Johnson Master
                          I found an AS 3.2.7 in a backup folder, looks like is has hte same file with the same entry.
                          • 11. Re: Do I need to restart JBoss??
                            Rasa Here Novice

                            Hi Peter ,


                            I don't know i am correct or not jnp port we can give in jboss-service.xml also rt ???. If i am wrong please correct it.In one of our jboss configuration i found the following entry


                              <mbean code="org.jboss.naming.NamingService"
                                  <!-- The listening port for the bootstrap JNP service. Set this to -1
                                    to run the NamingService without the JNP invoker listening port.
                                  <attribute name="Port">11099</attribute>
                                  <!-- The bootstrap JNP server bind address. This also sets the default
                                  RMI service bind address. Empty == all addresses
                                  <attribute name="BindAddress">${jboss.bind.address}</attribute>
                                  <!-- The port of the RMI naming service, 0 == anonymous -->
                                  <attribute name="RmiPort">11098</attribute>
                                  <!-- The RMI service bind address. Empty == all addresses
                                  <attribute name="RmiBindAddress">${jboss.bind.address}</attribute>



                            Thanks and Regards


                            • 12. Re: Do I need to restart JBoss??
                              Peter Johnson Master

                              Yes, the JNDI ports are defined in jboss-service.xml but it is recommended that you do not modify them there. The preferred mechansim is to use the port bindings service, which uses the bindings.xml file that Steve mentioned.


                              In addition, while in AS 3.x and 4.x the binding service was optional (and not used by default), in 5.x, the binding service is used by default and thus you should always edit the binding file (whose name and location varies depending on the exact version of 5.x).