Oracle ADF web applications, like any JEE application, have to follow some practices for correct behavior in a high availability environment. When you are designing an application to run in a clustered environment, you must:
- Ensure that all pageflowscope and viewscope managed beans must implement Serializable.
- Ensure that all pageflowscope and viewscope managed beans *should not* contain UI bindings. In essence, component bindings should live for a http request (request scope or backingBean scope). Any state or data you need for a longer duration can be saved in a pageflowscope bean separately.
When a value within a managed bean in either view scope or page flow scope is modified, the application needs to notify Oracle ADF so that it can ensure the bean’s new value is replicated.
Map <String, Object> viewScope = AdfFacesContext.getCurrentInstance().getViewScope(); MyObject obj = (MyObject)viewScope.get("myObjectName"); Obj.setFoo("newValue");
Without additional code, Oracle ADF will be unaware of this change and will not know that a new value needs to be replicated within the cluster. To inform Oracle ADF that an object in an ADF scope has been modified and that replication is needed, use the markScopeDirty() method. The markScopeDirty() method accepts only viewScope and pageFlowScope as parameters.
controllerContext ctx = ControllerContext.getInstance(); ctx.markScopeDirty(viewScope);
Jdeveloper integrated server will not spit these errors by default. The server has to be run with the following JVM parameter:
Note that this check is disabled by default to reduce runtime overhead. Do not use this after your testing is complete.
Some additional configuration to vertify:
1. adf-config.xml updates for high availability:
<adf-controller-config xmlns="http://xmlns.oracle.com/adf/controller/config"> <adf-scope-ha-support>true</adf-scope-ha-support> </adf-controller-config>
2. HTTP session state replication setting in weblogic.xml is setup
<weblogic-web-app> <session-descriptor> <persistent-store-type> replicated_if_clustered </persistent-store-type> </session-descriptor> </weblogic-web-app>
3. Oracle ADF is not configured by default for failover by default. Failover is supported only with the proper setting in the ADF Business Components configuration file (bc4j.xml):
Edit Business Components Configuration -> Pooling and Scalability tab ->Failover Transaction State Upon Managed Release checkbox to true.
<AppModuleConfig ... <AM-Pooling jbo.dofailover="true"/> </AppModuleConfig>
4. If you’re using Oracle HTTP Server, the server is configured with the WebLogicCluster directive to balance among all available application instances.
5. If you are using a hardware load balancer, the load balancer is:
- Routing traffic to all available instances.
- Configured correctly with a health monitor to mark unavailable instances.
- Configured to support persistence of session state
org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION parameter must not be set to
true when running in a high availability environment. Setting this context parameter to true can lead to errors after failover occurs.