Installation of Apache on Mac OS

1) Download Apache 1.3.x Binary from 
http://www.apache.org/dist/httpd/binaries/macosx/

I chose apache_1.3.29-powerpc-apple-darwin7.0.0.tar.gz  

Downloaded into my home directory /Users/anil

2) Install Apache

$ tar xvf apache_1.3.29-powerpc-apple-darwin7.0.0.tar
$ cd apache_1.3.29/
$ ./install-bindist.sh ~/apache1.3.29

Note: I chose apache1.3.29 as the directory.  You can choose whatever you want.

3) Since Apache by default runs on port 80, you will need the admin password for your Mac. Change yourself into admin user using the sudo command.

$ sudo sh

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these two things:

        #1) Respect the privacy of others.
        #2) Think before you type.

Password:

4) Since now you are the admin, go to the directory where apache is installed.
# cd /Users/anil/apache1.3.29/bin/
# ./apachectl start
./apachectl start: httpd started

Note: To stop Apache on Unix,  use  ./apachectl stop

5) Check your Apache installation by going to the browser and running:
http://localhost
You should see the default Apache page.

Reference:
http://developer.apple.com/internet/java/tomcat1.html

Installation of JBoss/Tomcat on Mac OS
1) Download a zip file of JBoss 3.2.x from Sourceforge. I chose 3.2.5. Save the file to your home directory.
2) Unzip the Jboss zip file as shown below:
$ unzip jboss-3.2.5.zip
$ rm jboss-3.2.5.zip
3) Go to your jboss directory and into server dir.
$ cd jboss-3.2.5/server
4) Make two instances of Jboss servers on the same box.
$ cp -R all instance1
$ cp -R all instance2

5) Name the two Tomcat instances as TOM1 andTOM2.

Go to instance1 and under 
~/jboss-3.2.5/server/instance1/deploy/jbossweb-tomcat50.sar
Edit the file "server.xml" file and add an attribute jvmRoute as follows:

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="TOM1">

Go to instance2 and under 
~/jboss-3.2.5/server/instance2/deploy/jbossweb-tomcat50.sar
Edit the file "server.xml" file and add an attribute jvmRoute as follows:

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="TOM2">

6) Since we may have port conflicts. Instance1 will retain the original port settings for Jboss/all. Now we will change the port settings for instance2.

Go to ~/jboss-3.2.5/server/instance2/conf  
Edit the file jboss-service.xml

Uncomment the section for ServiceBindingManager and change the location of StoreUrl as shown below

<!--
      | Binding service manager for port/host mapping. This is a sample
      | config that demonstrates a JBoss instances with a server name 'jboss1'
      | loading its bindings from an XML file using the ServicesStoreFactory
      | implementation returned by the XMLServicesStoreFactory.
      |
      | ServerName: The unique name assigned to a JBoss server instance for
      | lookup purposes. This allows a single ServicesStore to handle mulitiple
      | JBoss servers.
      |
      | StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
      | during initialization that specifies how to connect to the bindings store.
      | StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
      | implementation to create to obtain the ServicesStore instance.

   -->
   <mbean code="org.jboss.services.binding.ServiceBindingManager"
     name="jboss.system:service=ServiceBindingManager">
     <attribute name="ServerName">ports-01</attribute>
     <attribute name="StoreURL">../cluster-bindings.xml</attribute>
     <attribute name="StoreFactoryClassName">
       org.jboss.services.binding.XMLServicesStoreFactory
     </attribute>
   </mbean>

7) Go to ~/jboss-3.2.5/docs/examples/binding-manager and make a copy of the file sample-bindings.xml as cluster-bindings.xml under the jboss root directory.

cp sample-bindings.xml ~/jboss-3.2.5/cluster-bindings.xml

8) Start the two JBoss instances in different command windows.
./run.sh -c instance1 --host=localhost
./run.sh -c instance2 --host=localhost

Installing the mod_jk connector
1) Download the mod_jk1.2 connector
$ cd jakarta-tomcat-connectors-jk-1.2.5-macosx-apache-1.3.28
cp mod_jk.so ~/apache1.3.29/libexec/

Create the test jsp under the two instances:
cd ~/jboss-3.2.5/server/instance1/deploy/jbossweb-tomcat50.sar/ROOT.war
Add testsessionreplication.jsp
-----------------------------------------
<html>
<body bgcolor=blue>
<center>
<%=request.getSession().getId() %>
<h1>Tomcat 1</h1>
</body>
</html>

cd ~/jboss-3.2.5/server/instance2/deploy/jbossweb-tomcat50.sar/ROOT.war
testsessionreplication.jsp
----------------------------------
<html>
<body bgcolor=green>
<center>
<%=request.getSession().getId() %>
<h1>Tomcat 2</h1>
</body>
</html>

Go to JB/bin  in different terminal/command windows.

Start instance1  ./run.sh -c instance1 --host=localhost
Start instance2   ./run.sh -c instance2 --host=localhost

 8) Start Apache Server (You will have to do sudo)

9) Go to browser and test:
http://localhost/testsessionreplication.jsp

You should see a blue page with sessionid and Tomcat1

10) Shutdown instance1  (Do ctrl-c)

11) Go to browser and test
http://localhost/testsessionreplication.jsp

You should see a green page with sessionid and Tomcat2

Basically you can now start and stop either of the two tomcat instances in any order.  
The session is replicated and as long as one of them is running, you will always
see a response on browser.