Search This Blog

Monday, 25 May 2009

ADF11g fail over within a Weblogic 10.3 Cluster

I recently setup failover for a simple ADF11g application within a Oracle weblogic 10.3 cluster. Once you have your Oracle Weblogic 10.3 cluster in place you really only need to do 2 things on your application side.

Part A

1. Right click on your application module and select "Configurations".
2. Select your config and press the "Edit" button.
3. Click on "Pooling and Scalability" tab.
4. Select the check box "Failover Transaction State Upon Managed Release".
5. Press OK

This will generate the following for your bc4j.xcfg file in your model project with fail over feature switched on.
<AppModuleConfig DeployPlatform="LOCAL"
JDBCName="scott"
jbo.project="model.Model"
name="AppModuleLocal"
ApplicationName="model.AppModule">
<AM-Pooling jbo.dofailover="true"/>
<Security AppModuleJndiName="model.AppModule"/>
</AppModuleConfig>

This provides the most pessimistic protection against application server failure. The application module instances' state is always saved and may be activated by any application module instance at any time. Of course, this capability comes at expense of the additional overhead of eager passivation on each request.

For more information on state management see the following link:
http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcstatemgmt.htm#BABHIBDG

Part B

Now finally we need to ensure our view project which is packaged as a WAR file includes a weblogic.xml file within the WEB-INF folder as follows. This will ensure we setup our application to use HTTP Session replication in the event of a node failure.

<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app.xsd"
xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
<session-descriptor>
<timeout-secs>300</timeout-secs>
<invalidation-interval-secs>60</invalidation-interval-secs>
<persistent-store-type>replicated_if_clustered</persistent-store-type>
</session-descriptor>
</weblogic-web-app>

While testing this I used the following managed server property to determine which
managed server I was accessing at the time.

String instance = System.getProperty("weblogic.Name");

No comments: