Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Upgrade and Migration Guide

- Previous: Session Beans
- Next: Entity Beans

### Migrating EJB Applications that Support SFSB Failover (Enterprise Edition)

Sun ONE Application Server 6.5 supports failover of stateful session beans. To take advantage of the SFSB failover in 6.5, the session bean need to be configured with failover and DSync. The DSync (Distributed Store) mechanism is used to save the session beans’s conversational state during runtime.

Note –

Sun ONE Application Server 6.5 does not support failover of stateful session beans for rich clients on the RMI/IIOP path. Such applications can take advantage of SFSB failover on the RMI/IIOP path in Sun Java System Application Server 8.1. For more information on SFSB failover configuration, see Stateful Session Bean Failover in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide.

Sun Java System Application Server 8.1, Enterprise Edition supports failover of stateful session beans. Application Server 8.1 uses the High Availability Database (HADB) for storing session data. The principle followed in supporting SFSB failover in saving the conversational state of an SFSB at predefined points in its lifecycle to a persistent store. This mechanism is referred to as checkpointing. In case of a server crash, the checkpointed state of an SFSB can be retrieved from the persistent store. In order to use HADB for storing session data, you must configure HADB as the persistent store. The underlying store for the HTTP sessions and stateful session beans is same and the configuration of persistent store is exactly similar to configuration of session store.

For information on configuring HADB for session failover, see Chapter 8, Configuring High Availability Session Persistence and Failover, in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide.

Migration of stateful session beans deployed in Sun ONE Application Server 6.5 to Sun Java System Application Server 8.1 does not require any changes in the EJB code. However, the following steps must be performed:

- Modify the `<!DOCTYPE` definition to point to the latest DTD url in case of J2EE standard DDs, like `ejb-jar.xml`.

- Replace `ias-ejb-jar.xml` with the modified version of this file, i.e., `sun-ejb-jar.xml`, which is created manually according to the DTDs.

- Replace all the `<`ejb-name`>-ias-cmp.xml` files with one `sun-cmp-mappings.xml` file, which is created manually.

- No changes are required in the application source code for taking advantage of the SFSB state failover support. All configuration needed for checkpointing SFSBs will be applied at the Application Server specific deployment descriptor (`sun-ejb-jar.xml`), or in the domain configuration file (`domain.xml`).

  However, if you are accessing theEJBs through servlets then you need to store the EJB home and remote references in the session. The following is the code example to store ejbHome and ejbRemote interfaces in the session:

      session.setAttribute("ejbhome", ejbHome);
      session.setAttribute("ejbremote", ejbRemote);

  The following code example demonstrates how to retrieve the ejbHome and ejbRemote from the session:

      ejbHome = session.getAttribute("ejbhome");
      ejbRemote = session.getAttribute("ejbremote");

- In the domain.xml, make sure that the `availability-enabled` attribute of `availability-service` element is set to TRUE. If `availability-enabled` attribute is set to TRUE indicates that failover is enabled at the server instance level. That is, if a server instance fails to process a request, the request is routed to the next available server instance.

  SFSB checkpointing adds performance overhead on the EJB container, you may want to restrict checkpointing to a list of SFSBs whose state failover is critical to the application.

  You can enable/disable the checkpointing at the method level in `sun-ejb-jar.xml`. For more details seeSpecifying Methods to Be Checkpointed in Sun Java System Application Server Enterprise Edition 8.1 2005Q2 High Availability Administration Guide.

  If, in the deployment descriptor for the SFSB ejb module in 6.5 (`ias-ejb-jar.xml`), the `failoverrequired` attribute of the `session` element is set to TRUE, you might want to enable availability-service for such ejb modules in the Application Server 8.1 environment.

- Previous: Session Beans
- Next: Entity Beans

- © 2010, Oracle Corporation and/or its affiliates