WADI

Geronimo supports the clustering of web applications by using WADI, Application Distribution Infrastructure. When a clustered web application is deployed in Geronimo, the deployer adds dependencies on two configurations:

  • org.apache.geronimo.configs/clustering//car: This configuration contains runtime dependencies that the clustered application must have. This configuration also has a Node GBean that defines a unique node name with which the Geronimo server instance will be identified in the cluster. Use the clusterNodeName property in var/config/config-substitutions.properties to reconfigure the node name of your Geronimo server instance.

  • org.apache.geronimo.configs/wadi-clustering//car: This configuration contains WADI-related GBeans used to configure the behaviour of clustered applications and the WADI group communication service shared by all of the clustered applications to communicate with each other.

    The number of replicas to be maintained across the cluster for a session is configured as 2 by the DefaultBackingStrategyFactory GBean. To reconfigure the number of replicas, use the ReplicaCount property in var/config/config-substitutions.properties. The name for the cluster and endpoint URI are configured by the DefaultDispatcherHolder GBean. To reconfigure these, use the ClusterName and EndPointURI properties in var/config/config-substitutions.properties.

WADI uses multicast for dynamic discovery of nodes in the cluster. So the server instances that want to use WADI for session replication must be running on the same subnet that supports multicast. Each node has a group communication component containing a Dispatcher and ServiceSpace wrapped in a TribesDispatcherHolder GBean and Cluster wrapped in a BasicWADICluster GBean. The group communication components can see each other and dispatch messages between them. Geronimo uses the WADI integration of Tribes for group communication. For more details on this, you can visit the Apache WADI project hosted at http://incubator.apache.org/wadi/ and Apache Tribes web page at http://tomcat.apache.org/tomcat-6.0-doc/tribes/introduction.html.

Updating deployment descriptor and deployment plan

In the Java EE deployment descriptor web.xml for your web application, you must mark the application as distributable by adding the optional <distributable> element. The following shows the deployment descriptor for the Helloworld Cluster sample:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app ... >
<display-name>Helloworld Cluster Web Sample</display-name>
<distributable/>
<servlet>
<servlet-name>HelloworldServlet</servlet-name>
<servlet-class>sample.HelloworldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloworldServlet</servlet-name>
<url-pattern>/servlet/HelloworldServlet</url-pattern>
</servlet-mapping>
<welcome-file-list id="WelcomeFileList">
<welcome-file>hello.html</welcome-file>
</welcome-file-list>
</web-app>

The Geronimo-specific deployment plan geronimo-web.xml must define the <tomcat-clustering-wadi> element for a clustered application to be deployed in a Geronimo Tomcat distribution. For a clustered application to be deployed in a Geronimo Jetty distribution, use the <clustering-wadi> element. The following is the deployment plan of the helloworld-cluster sample from geronimo-web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/ deployment-1.2">
<dep:moduleId>
<dep:groupId>packt-samples</dep:groupId>
<dep:artifactId>helloworld-cluster</dep:artifactId>
<dep:version>1.0</dep:version>
<dep:type>war</dep:type>
</dep:moduleId>
<dep:dependencies/>
</dep:environment>
<context-root>/helloworld-cluster</context-root>
<tomcat-clustering-wadi/>
</web-app>

The org.apache.geronimo.configs/tomcat6-clustering-builder-wadi//car configuration must be running in order to deploy your clustered application. Otherwise, the <tomcat-clustering-wadi> element will not be recognized, and the deployment will fail. This configuration contains the TomcatClusteringBuilder GBean that adds the necessary dependencies on org.apache.geronimo.configs/tomcat6-clustering-wadi//car for clustering support. Starting your clustered application will automatically start the WADI-related configurations.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset