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 ji...@apache.org on 2004/04/17 17:08:31 UTC

[jira] Closed: (CACTUS-85) Bad JBoss shutdown when using non-standard JBoss ports

Message:

   The following issue has been closed.

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/CACTUS-85

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: CACTUS-85
    Summary: Bad JBoss shutdown when using non-standard JBoss ports
       Type: Bug

     Status: Closed
   Priority: Blocker
 Resolution: FIXED

    Project: Cactus
 Components: 
             Ant Integration
   Fix Fors:
             1.6
   Versions:
             1.5

   Assignee: Vincent Massol
   Reporter: James Carpenter

    Created: Wed, 7 Jan 2004 10:59 PM
    Updated: Sat, 17 Apr 2004 8:07 AM
Environment: Operating System: All
Platform: All

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


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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