Undeploying a Retiring Application Rolling Back the Production Redeployment Process Graceful Shut Down of RMI Client Request Processing

8-8 Deploying Applications to Oracle WebLogic Server 4. Redeploy the new application version and specify the updated deployment files. If the updated deployment files contain a unique version identifier in the manifest file, use a command similar to: java weblogic.Deployer -adminurl http:localhost:7001 -user weblogic -password weblogic -redeploy -name myTestDeployment -source myDeploymentsmyApplication1.0GA If the new deployment files do not contain a version identifier in the manifest, see Section 8.3.4.1, Assigning a Version Identifier During Deployment and Redeployment . By default WebLogic Server makes the newly-redeployed version of the application active for processing new client requests. Existing clients continue to use the older application until their work is complete and the older application can be safely undeployed. If you want to specify a fixed time period after which the older version of the application is retired regardless of whether clients finish their work, use the -retiretimeout option with the -redeploy command: java weblogic.Deployer -adminurl http:localhost:7001 -user weblogic -password weblogic -redeploy -name myTestDeployment -source myDeploymentsmyApplication1.0GA -retiretimeout 300 -retiretimeout specifies the number of seconds after which the older version of the application is retired. You can also retire the older application immediately by using the -undeploy command and specifying the older application version, as in: java weblogic.Deployer -adminurl http:localhost:7001 -user weblogic -password weblogic -undeploy -name myTestDeployment -appversion .91Beta 5. Verify that both the old and new versions of the application are deployed, and that the correct version of the application is active. See Section 8.3.5, Displaying Version Information for Deployed Applications .

8.3.7 Undeploying a Retiring Application

If WebLogic Server has not yet retired an application version, you can immediately undeploy the application version without waiting for retirement to complete. This may be necessary if, for example, an application remains in the retiring state with only one or two long-running client sessions that you do not want to preserve. To force the undeployment of a retiring version of an application, use the -undeploy command and specify the application version: java weblogic.Deployer -adminurl http:localhost:7001 -user weblogic -password weblogic -undeploy -name myTestDeployment -appversion .91Beta Redeploying Applications in a Production Environment 8-9

8.3.8 Rolling Back the Production Redeployment Process

Reversing the production redeployment process switches the state of the active and retiring applications and redirects new client connection requests accordingly. Reverting the production redeployment process might be necessary if you detect a problem with a newly-deployed version of an application, and you want to stop clients from accessing it. To roll back the production redeployment process, issue a second -redeploy command and specify the deployment source files for the older version, as in: java weblogic.Deployer -adminurl http:localhost:7001 -user weblogic -password weblogic -redeploy -name myTestDeployment -source myDeploymentsmyApplication91Beta -retiretimeout 300 If the deployment files do not contain a version identifier in the manifest, see Section 8.3.4.1, Assigning a Version Identifier During Deployment and Redeployment .

8.3.9 Graceful Shut Down of RMI Client Request Processing

You can use the -rmigraceperiod attribute to specify a grace period in seconds for processing of RMI client requests when retiring -retirement or gracefully -graceful shutting down an application. The work manager of a server instance accepts and schedules RMI calls until the grace period expires without a receiving new RMI client request. If a new RMI client request occurs within the grace period, the grace period is reset and RMI client processing continues until: ■ Another RMI request resets the grace period or ■ The grace period expires without an RMI client request. If an RMI client tries to access a retired application or a shutdown application, the client receives NoSuchObjectException when trying to invoke the object. If a new version of the object is available, an application needs to catch the NoSuchObjectException exception and look up the new version of the object using the JNDI environment property weblogic.jndi.WLContext.RELAX_VERSION_ LOOKUP to return bindings from the active version of the application. For example, the following command places the application in Administration mode after allowing any pending HTTP sessions or in-process work to complete: java weblogic.Deployer -adminurl http:localhost:7001 -user weblogic -password weblogic -name mymodule -stop -adminmode -graceful -rmigraceperiod 30 Notes: You cannot specify the -graceful option to the -undeploy command when undeploying an application version that is being retired, or waiting for a retirement timeout to occur. If you do not explicitly specify an application version with the -appversion option, WebLogic Server undeploys the active version and all retired versions of the application. If an older version of the application is not yet retired and you run the -undeploy command without specifying the -appversion option, WebLogic Server logs a warning message in the server log and does not undeploy the unretired version. To later undeploy such versions of the application, you must run the -undeploy command again and specify the application version with the -appversion option. 8-10 Deploying Applications to Oracle WebLogic Server If graceful retirement is initiated at T0 seconds, and a RMI request msg1 arrives at T1 seconds where T1 T0 + 30, the application waits for T1 + 30 seconds for additional RMI client requests. ■ If msg2 arrives at T2 seconds, where T2 T1 +30, msg2 is scheduled and the grace period is reset to T2+30 seconds. ■ If there are no additional requests or a request msg2 arrives at T2 seconds, where T2 T1 +30, the work manager stops scheduling RMI requests.

8.4 Distributing a New Version of a Production Application

When you distribute a new version of an application, WebLogic Server prepares the new application version for deployment. You can then deploy the application in Administration mode, which makes it available only via a configured Administration channel. External clients cannot access an application that has been distributed and deployed in Administration mode. You can use the -adminmode option to start the application in administration mode. For information, see Section 6.10.2, Starting a Distributed Application in Administration Mode . The older version of the application remains active to process both new and existing client requests. WebLogic Server does not automatically retire the older version of the application when you distribute and deploy a newer version in Administration mode. Figure 8–2 Distributing a New Version of an Application After you complete testing of the new application via an Administration channel, you either undeploy the new application version or start it. Starting the application causes WebLogic Server to route new client connections to the updated application, and begin retiring the older application version.