Oracle GlassFish Server 3.0.1 Application Deployment Guide

ProcedureTo Redeploy an Application or Module

Use the redeploy subcommand in remote mode to overwrite a previously–deployed application or module. You can also accomplish this task by using the --force option of the deploy subcommand. Whenever a redeployment is done, the sessions in transit at that time become invalid unless you use the keepSessions=true property of the redeploy subcommand.

Before You Begin

You must remove a preconfigured resource before it can be updated.

  1. Ensure that the server is running.

    Remote commands require a running server.

  2. Redeploy an application or module by using the redeploy(1) subcommand or the deploy(1) subcommand with the --force option.

    Information about the options and properties of these commands is included in these help page.

Example 2–7 Retaining HTTP Session State During Redeployment

This example redeploys the hello web application. In a production environment, you usually want to retain sessions. If you use the keepSessions property, active sessions of the application are retained and restored when redeployment is complete.

asadmin> redeploy --name hello --properties keepSessions=true hello.war
Application deployed successfully with name hello.
Command redeploy executed successfully.

Keep Sessions is a checkbox option when you redeploy using the Administration Console. For instructions, see the Administration Console online help.

Example 2–8 Redeploying a Web Application That Was Deployed From a Directory

This example redeploys the hello web application, which was originally deployed from the hellodir directory. The path is retrieved from the domain.xml file.

asadmin>redeploy --name hellodir
Application deployed successfully with name hellodir.
Command redeploy executed successfully.

Example 2–9 Redeploying an Application by Using asadmin deploy --force

The --force option is set to false by default. This example redeploys newApp.ear even if has been deployed or already exists.

asadmin> deploy --force=true newApp.ear
Application deployed successfully with name newApp.
Command deploy executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help redeploy at the command line.