8 Replies Latest reply on Nov 15, 2002 4:30 PM by ronia

    shutdown.sh doesn't work when JBoss started as root

    cunparis

      If I use a normal user account, run.sh and shutdown.sh work fine. If I try it as root, run.sh starts JBoss ok but shutdown.sh doesn't shut it down. I get no errors or anything. I've tried running the java command manually and get the same result, it runs but JBoss doesn't shutdown.

      Anyone seen this?

      Michael

        • 1. Re: shutdown.sh doesn't work when JBoss started as root
          pope

          I have just tried the shutdown script and it is working. There seems to me to be no problems.
          Detail it !


          There are only solutions !
          ---
          Pope

          • 2. Re: shutdown.sh doesn't work when JBoss started as root
            joelvogt

            Please post what versions of jboss and os you are using, as well as any custom config you have done. Is this is a clean install?

            • 3. Re: shutdown.sh doesn't work when JBoss started as root
              cunparis

              This is a clean install of the latest version 3.0.3 (with Jetty) on Linux (Mandrake 8.2). I'm using the jboss run.sh & shutdown.sh scripts, and the only environment variable I set is for JAVA_HOME. If I start it with root, the shutdown doesn't work. If I start it with a non-root account, shutdown works. I can't figure it out.

              • 4. Re: shutdown.sh doesn't work when JBoss started as root
                kosulin

                I have the same problem with JBoss 3.0.3/JDK1.4.1_01/RedHat 7.3. shutdown.sh does not work for 'root'. And 'jboss_init_redhat.sh stop' does not work, too.

                • 5. Re: shutdown.sh doesn't work when JBoss started as root
                  kosulin

                  Do you have HTTP disabled? If yes, here is the problem: Shutdown.java uses JMX-console to shutdown server, and it uses hardcoded HTTP as protocol:

                  public class Shutdown
                  {
                  private static final String COMMAND=
                  "/jmx-console/HtmlAdaptor?action=invokeOpByName&name=jboss.system%3Atype%3DServer&methodName=shutdown";

                  /**
                  * Parse the command line and shutdown the remote server.
                  *
                  * @param argv Command line arguments.
                  * @throws Exception Invalid port number.
                  */
                  public static void main(final String argv[]) throws Exception
                  {
                  String host = "localhost";
                  int port = 8080;

                  if (argv.length >= 1)
                  {
                  host = argv[0];
                  }

                  if (argv.length >= 2)
                  {
                  port = Integer.parseInt(argv[1]);
                  }

                  shutdown(host, port);
                  }

                  /**
                  * Connect to the JBoss servers HTML JMX adapter and invoke the
                  * shutdown service.
                  *
                  * @param host The hostname of the JMX server.
                  * @param port The port of the JMX server.
                  *
                  */
                  public static void shutdown(final String host, final int port)
                  {
                  try
                  {
                  System.out.println("Shutting down server "+host+":"+port);
                  URL url = new URL("http", host, port, COMMAND);
                  url.getContent();
                  }
                  catch (Exception ignore)
                  {
                  // we do nothing because even if everything went
                  // right, ie JBoss is shutdown, we'd get an exception
                  }
                  System.out.println("Shutdown complete");
                  }
                  }

                  I am going to open a bug report now.

                  • 6. Re: shutdown.sh doesn't work when JBoss started as root
                    kosulin

                    Addition: may be root can not shutdown because by default root cann not access port 80, which is required by Shutdown.java

                    • 7. Re: shutdown.sh doesn't work when JBoss started as root
                      dwong

                      Hi, which port does it use to shutdown with HTTP ? Is it 8080 ? I can't see JBoss listens to port 8080. Can it configure it ?

                      For me, I even cannot shutdown with any kind of users. I just use kill command. Is it a proper way to do that ? I am using JBoss 3.0.3.

                      • 8. Re: shutdown.sh doesn't work when JBoss started as root
                        ronia

                        Hi, You have to modify the shutdown.sh

                        and replace

                        exec $JAVA \
                        $JAVA_OPTS \
                        -classpath $JBOSS_CLASSPATH \
                        org.jboss.Shutdown "$@"

                        by

                        exec $JAVA \
                        $JAVA_OPTS \
                        -classpath $JBOSS_CLASSPATH \
                        org.jboss.Shutdown "$@" localhost 80

                        Ronia