You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by bu...@apache.org on 2004/01/07 23:59:55 UTC

DO NOT REPLY [Bug 25968] New: - Bad JBoss shutdown when using non-standard JBoss ports

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25968>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25968

Bad JBoss shutdown when using non-standard JBoss ports

           Summary: Bad JBoss shutdown when using non-standard JBoss ports
           Product: Cactus
           Version: 1.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Ant Integration
        AssignedTo: cactus-dev@jakarta.apache.org
        ReportedBy: jacarpenter@ercot.com


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();
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org