Uploaded image for project: 'Cactus'
  1. Cactus
  2. CACTUS-85

Bad JBoss shutdown when using non-standard JBoss ports

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5
    • 1.6
    • Ant Integration
    • None
    • Operating System: All
      Platform: All
    • 25968

    Description

      At the following URL there is a description of what ports must be changed to
      run multiple instances of JBoss on the same machine.
      http://www.yorku.ca/dkha/jboss/docs/MultipleInstances.htm
      Included in the ports that must be changed is port 1099 which is used by JNDI.

      The org.apache.cactus.integration.ant.container.jboss.JBoss3xContainer class
      provides an option to set the port that cactus will use to make http requests
      to the server instance that is started. As reflected in the documentation it
      is my job to make sure JBoss is correctly set up on whatever non-standard ports
      I have choosen. (I am making use of Ant's token replacement to achieve this on
      a per machine/per user basis.)

      The problem is that when the JNDI port is something other than 1099 the
      JBoss3xContainer has problems shutting down the server instance it started.

      I looked at the most current version of JBoss3xContainer in CVS and didn't see
      any fix for the problem.

      I noticed from inspection of the JBoss3xContainer code that it is simply
      running java on the org.jboss.Shutdown class with the appropriate options to
      affect the shutdown. As it turns out the org.jboss.Shutdown class supports a –
      server=blah option that can be used to affect what JNDI port is used. So if I
      copy and rename the JBoss3xContainer code to create a custom
      org.apache.cactus.integration.ant.container.Container class I can cause my
      adaptation to pass a --server=localhost:X argument when org.jboss.Shutdown is
      run. As you would expect I created a getter and setter that allowed me to
      specify the JNDI port that will be used for X.

      To make my custom Container class work I created a copy of the
      org/apache/cactus/integration/ant/container/default.properties, listed my
      custom class within this file, and made sure my version of the
      default.propertiesfile was before the cactus-ant-1.5.jar in the classpath
      passed to the taskdef ant task that imports the cactus ant tasks.

      This solved the problem on both Windows 2000 and a Sun Sparc machine. A
      similar approach should be rolled into the JBoss3xContainer. My relevant code
      snipts are:

      /**

      • The server JNDI Port (used during shutdown)
        */
        private String JNDIPort;

      /**

      • Specify the JNDI Port.
        *
      • @param theJNDIPort The JNDI Port
        */
        public final void setJNDIPort(String theJNDIPort) { this.JNDIPort = theJNDIPort; }

      /**

      • Returns the server JNDI Port.
        *
      • @return The JNDI Port
        */
        public final String getJNDIPort() { return this.JNDIPort; }

      /**

      • @see org.apache.cactus.integration.ant.container.Container#shutDown
        */
        public final void shutDown()
        {
        File binDir = new File(this.dir, "bin");

      Java java = createJavaForShutDown();
      java.setFork(true);

      Path classPath = java.createClasspath();
      classPath.createPathElement().setLocation(
      new File(binDir, "shutdown.jar"));

      java.setClassname("org.jboss.Shutdown");

      //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      //The next few lines specifying a --server option
      //is the primary difference between the
      //CustomJBoss3xContainer and the one that ships
      //with Cactus.
      //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      if(this.getJNDIPort() != null)

      { java.createArg().setValue("--server=localhost:" + this.getJNDIPort ()); }

      if (this.version.startsWith("3.2"))

      { java.createArg().setValue("--shutdown"); }

      else

      { java.createArg().setValue("localhost"); java.createArg().setValue(String.valueOf(getPort())); }

      java.execute();
      }

      Attachments

        Activity

          People

            vmassol Vincent Massol
            jacarpenter@ercot.com James Carpenter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: