1 Reply Latest reply on Apr 5, 2010 7:42 AM by jaikiran

    Restarting deployed components from within a deployed web application?

      I think this topic needs a little background information..  Our production environment is managed by another, rather bureaucratic group.  They don't like us very much.  Everytime we need to do anything there, we have to file several requests, deal with phone calls, etc etc.  It's just a great big hassle for both us and them, and usually it boils down to something we could do ourselves in 5 seconds, "copy this file, paste to this directory."    That can take days to get accomplished.  (And sometimes a few more days to get accomplished correctly).   They are busy with much more important things and we generally don't like to bother them...

       

      Our application has a messaging service, built on top of activemq, which turns out to be very much unstable.   Long story here, but the connectors never reconnect, activemq has 275+ open bugs, a couple of which are causing serious disruptions.  Most notably one of them, what I call the narcoleptic broker bug, is a major problem.  After several days of healthty operation, the broker will literally fall asleep and stop dispatching messages to the other end for no reason.  Logs and everything remain healthy.  Well, I like to sleep on the job sometimes too, so I can't get too upset.  .   And of course, this never showed itself in the test environment, becuase we don't run tests for 5 or 6 days.... (we need to)

       

      So whenever this happens about once a week, activemq needs touched for a restart, and then our app needs touched to reconnect to activemq.  We are working on rearcheticting all of this to use something that works.  In the meantime, I have to file all these requests and get eyes rolled at me to get the application restarted at a much later time.  So we are looking for a 'quick dirty temporary band aid' sort of fix here.

       

      I know the JMX console that ships with jboss has a thing deep in there somewhere to send a command to a deployed app to restart.  This group will not open the port for the jmx console since it poses a 'security threat'

       

      So my question is, is there a way I can embed that little feature into the application itself?  We already have a secret sysadmin only page to show the applicaiton status, if I could get a button on there to 'restart activemq'  and 'restart messaging service' and 'restart this applicaiton', that would be pretty ideal.  Clicking the button would send the command to jboss to restart.

       

      I know it's bad, but if that is even possible to do, how do i go about getting 'restart application' button there to touch a war file or send a command to the jboss container?  jboss 4.22

       

      Thanks

        • 1. Re: Restarting deployed components from within a deployed web application?
          jaikiran

          John Newman wrote:

           

          I think this topic needs a little background information..  Our production environment is managed by another, rather bureaucratic group.  They don't like us very much.  Everytime we need to do anything there, we have to file several requests, deal with phone calls, etc etc.  It's just a great big hassle for both us and them, and usually it boils down to something we could do ourselves in 5 seconds, "copy this file, paste to this directory."    That can take days to get accomplished.  (And sometimes a few more days to get accomplished correctly).   They are busy with much more important things and we generally don't like to bother them...

           


          Reminds me of one of the projects I was involved in

           

          John Newman wrote:

           


          I know the JMX console that ships with jboss has a thing deep in there somewhere to send a command to a deployed app to restart.  This group will not open the port for the jmx console since it poses a 'security threat'

           


          The jmx-console is a webapplication and can be accessed through the HTTP port (default = 8080). Is that port blocked? By the way, you can configure the jmx-console for password protection. So only a few authorized users will be able to access it. There a bit more to be done too http://community.jboss.org/wiki/SecureJBoss

           

          John Newman wrote:

           


          So my question is, is there a way I can embed that little feature into the application itself?  We already have a secret sysadmin only page to show the applicaiton status, if I could get a button on there to 'restart activemq'  and 'restart messaging service' and 'restart this applicaiton', that would be pretty ideal.  Clicking the button would send the command to jboss to restart.

           


          You can invoke the MBean operation on the MainDeployer (responsible for redeploying the applications) from within your application. Here's an example http://community.jboss.org/wiki/HowDoIGetRemoteAccessToMyMBean