4 Deploying Applications

Deployment is the process of packaging application files as an archive file and transferring them to a target application server. This chapter describes how to deploy Java EE applications to Oracle Fusion Middleware.

It contains the following topics:

4.1 Overview of Deploying Applications

Oracle WebLogic Server provides a Java EE-compliant infrastructure for deploying, undeploying, and redeploying Java EE-compliant applications and modules.

You can deploy the following into Oracle WebLogic Server:

  • A complete Java EE application packaged as an Enterprise Archive (EAR) file.

  • Standalone modules packaged as Java Archive files (JARs) containing Web Services, Enterprise JavaBeans (EJBs), application clients (CARs), or resource adapters (RARs).

  • An ADF application. Oracle Application Development Framework (Oracle ADF) is an end-to-end application framework that builds on Java Platform, Enterprise Edition (Java EE) standards, and open-source technologies to simplify and accelerate implementing service-oriented applications.

  • An Oracle SOA Suite composite application. A SOA composite application is a single unit of deployment that greatly simplifies the management and lifecycle of SOA applications.

  • An Oracle WebCenter Portal application. WebCenter applications differ from traditional Java EE applications in that they support run-time customization, including the application's pages, the portlets contained within these pages, and document libraries.

A Metadata Archive (MAR) is a compressed archive of selected metadata, such as the application-level deployment profile, for an application. A MAR is used to deploy metadata content to the metadata service (MDS) repository. The following application types use a MAR as a container for content that is deployed to the MDS repository: ADF applications, SOA composite applications, and Oracle WebCenter Portal applications.

You can use Fusion Middleware Control, Oracle WebLogic Server Administration Console, Oracle JDeveloper, or the command line to deploy, undeploy, or redeploy an application. Which method you use depends on the type of application, as described in Table 4-1. This chapter describes how to deploy an application using Fusion Middleware Control.

Table 4-1 Tools to Deploy Applications

Type of Application Tools to Use

Pure Java EE application

Oracle WebLogic Server Administration Console

Fusion Middleware Control: Deployment Wizard

Oracle JDeveloper

WLST command line

ADF application

Fusion Middleware Control: Deployment Wizard

Oracle JDeveloper

WLST command line

SOA Composite application

Fusion Middleware Control: SOA Composite Deployment Wizard

Oracle JDeveloper

WLST command line

WebCenter Portal application

Fusion Middleware Control: Deployment Wizard

Oracle JDeveloper

WLST command line


If your application uses an MDS Repository, you must register the repository with the Oracle WebLogic Server domain before you deploy your application. Applications such as custom Java EE applications developed by your organization and some Oracle Fusion Middleware component applications, such as Oracle B2B and Oracle Web Services Manager, use an MDS Repository. For information about the MDS Repository and registering the repository, see "Managing the MDS Repository" in the Oracle Fusion Middleware Administrator's Guide.

4.2 Understanding Deployment, Redeployment, and Undeployment

When you deploy an application, you deploy it to the application server for the first time.

When you redeploy an application, you can:

  • Redeploy a new version of the application; the previous version is still available, but the state is set to "Retired."

    This is known as the production redeployment strategy. Oracle WebLogic Server automatically manages client connections so that only new client requests are directed to the new version. Clients already connected to the application during the redeployment continue to use the older version of the application until they complete their work, at which point Oracle WebLogic Server automatically retires the older application.

  • Redeploy the same version of the application or redeploy an application that is not assigned a version; the application version you select is replaced with the new deployment.

  • Redeploy a previous version of the application; the earlier, retired version is set to "Active" and the later version is set to "Retired."

When you undeploy an application, Oracle WebLogic Server stops the application and removes staged files from target servers. It does not remove the original source files used for deployment.

4.3 Understanding and Managing Data Sources

A data source is a Java object that application components use to obtain connections to a relational database. Specific connection information, such as URL or user name and password, are set on a data source object as properties and do not need to be explicitly defined in an application's code. This abstraction allows applications to be built in a portable manner, because the application is not tied to a specific back-end database. The database can change without affecting the application code.

Applications use the Java Naming and Directory Interface (JNDI) API to access a data source object. The application uses a JNDI name that is bound to the data source object. The JNDI name is logical and can be mapped to any data source object. Like data source properties, using JNDI provides a level of abstraction, since the underlying data source object can change without any changes required in the application code. The end result is the details of accessing a database are transparent to the application.

When you configure certain Oracle Fusion Middleware components, such as Oracle SOA Suite or Oracle WebCenter Portal, using the Oracle WebLogic Server Configuration Wizard, you specify the data source connection information. If the components use the MDS Repository, the Configuration Wizard prepends "mds-" to the data source name to indicate that the data source is a system data source used by MDS Repository.

If you are using Oracle Real Application Clusters (Oracle RAC) or Oracle Fusion Middleware Cold Failover Cluster, you must configure one of the following types of data sources:

  • Multi data sources

    To use multi data sources, you must use the Oracle WebLogic Server Administration Console. Note that if you create a multi data source and you add an existing MDS data source to it, the data source you added is no longer considered a valid MDS Repository. The repository is not displayed in Fusion Middleware Control or Oracle WebLogic Server Administration Console. For example, the MDS Repository is not listed in the Fusion Middleware Control navigation pane and is not displayed as a choice for a target metadata repository when you deploy an application.

  • GridLink data sources

    To use GridLink data sources, you can use the Oracle WebLogic Server Administration Console or Fusion Middleware Control, as described in "Creating a GridLink Data Source Using Fusion Middleware Control" in the Oracle Fusion Middleware Administrator's Guide.

See Also:

Oracle Fusion Middleware Creating Domains Using the Configuration Wizard for information about specifying data sources with the Configuration Wizard

4.3.1 Creating and Managing JDBC Data Sources

You can create and manage JDBC data sources using the following management tools:

  • The Oracle WebLogic Server Administration Console

  • The WebLogic Scripting Tool (WLST)

  • Fusion Middleware Control

To create an MDS data source manually, you should use Fusion Middleware Control or WLST to set the correct attributes for the data source. The MDS data source is displayed in the navigation pane in Fusion Middleware Control and in the domain structure in the Administration Console. If your application uses an MDS Repository, you must register the repository with the Oracle WebLogic Server domain before you deploy your application. For information about the MDS Repository and registering the repository, see "Managing the MDS Repository" in the Oracle Fusion Middleware Administrator's Guide.

See Also:

Oracle Fusion Middleware Configuring and Managing JDBC for Oracle WebLogic Server for information about creating and managing a data source using the Oracle WebLogic Server Administration Console or WLST and about configuring multi data sources

The following topics describe how to create and manage JDBC data sources with Fusion Middleware Control:

4.3.1.1 Creating a JDBC Data Source Using Fusion Middleware Control

To create a JDBC data source using Fusion Middleware Control:

  1. From the navigation pane, expand the farm, then WebLogic Domain.

  2. Select the domain to display the Domain home page.

  3. From the WebLogic Domain menu, choose JDBC Data Sources.

    The JDBC Data Sources page is displayed, as shown in the following figure:

    Description of jdbc.gif follows
    Description of the illustration jdbc.gif

  4. Click Create to open the Creating New JDBC Data Source wizard.

  5. Follow the instructions in the wizard to set the properties of the data source and to target the data source for one or more of the Managed Servers in the domain.

    For help on individual fields and properties, use your mouse to give focus to a field. Fusion Middleware Control displays a popup definition of the field.

    Note that the data source properties you define in Fusion Middleware Control are similar to those you define when creating data sources in the Oracle WebLogic Server Administration Console. As a result, you can also refer to "Creating a JDBC Data Source" in Oracle Fusion Middleware Configuring and Managing JDBC for Oracle WebLogic Server for more information about the data source properties.

4.3.1.2 Editing a JDBC Data Source Using Fusion Middleware Control

To edit an existing JDBC data source using Fusion Middleware Control:

  1. From the navigation pane, expand the farm, then WebLogic Domain.

  2. Select the domain to display the Domain home page.

  3. From the WebLogic Domain menu, choose JDBC Data Sources.

    The JDBC Data Sources page is displayed.

  4. Select the data source that you want to edit.

  5. Click Edit to display the Edit JDBC Data Source page.

  6. Use the tabs on this page to modify the properties of the selected data source.

    For help on individual fields and properties, use your mouse to give focus to a field. Fusion Middleware Control displays a popup definition of the field.

    Note that the data source properties you edit in Fusion Middleware Control are similar to those you edit when editing data sources in the Oracle WebLogic Server Administration Console. As a result, you can also refer to "Creating a JDBC Data Source" in Oracle Fusion Middleware Configuring and Managing JDBC for Oracle WebLogic Server for more information about the data source properties.

4.3.1.3 Monitoring a JDBC Data Source Using Fusion Middleware Control

To monitor a JDBC data source using Fusion Middleware Control:

  1. From the navigation pane, expand the farm, then WebLogic Domain.

  2. Select the domain to display the Domain home page.

  3. From the WebLogic Domain menu, choose JDBC Data Sources.

    The JDBC Data Sources page is displayed.

  4. Select the data source that you want to monitor.

  5. Click Monitoring to display the Monitor JDBC Data Source page.

    This page shows the current instances of the selected data source.

    Note that only data sources that are targeted to a running Managed Server are shown on this page. If a specific data source is not listed on the control page, edit the data source to be sure that it is targeted to a running Managed Server.

  6. For each data source instance, review the performance metrics.

    For information on how to get help on individual performance metrics, see "Viewing Performance Metrics Using Fusion Middleware Control" in the Oracle Fusion Middleware Performance and Tuning Guide.

4.3.1.4 Controlling a JDBC Data Source Using Fusion Middleware Control

You can start, stop, suspend, resume, or clear the statement cache for a JDBC data source using Fusion Middleware Control

To control a JDBC data source using Fusion Middleware Control:

  1. From the navigation pane, expand the farm, then WebLogic Domain.

  2. Select the domain to display the Domain home page.

  3. From the WebLogic Domain menu, choose JDBC Data Sources.

  4. Click Control to display the Control JDBC Data Source page.

    Note that only data sources that are targeted to a running Managed Server are shown on this page. If a specific data source is not listed on the control page, then edit the data source to be sure it is targeted to a running Managed Server.

  5. Click Start, Stop, Force Stop, Resume, Suspend, Force Suspend, Shrink, Reset, or Clear Statement Cache to control or change the state of the selected JDBC data source.

    Note that the commands you select on this page are similar to those available when you are managing data sources in the Oracle WebLogic Server Administration Console. As a result, you can refer to "Managing WebLogic JDBC Resources" in Oracle Fusion Middleware Configuring and Managing JDBC for Oracle WebLogic Server for more information about the JDBC data source control options.

4.4 Deploying and Undeploying Java EE Applications

The following topics describe using Fusion Middleware Control to deploy, undeploy, or redeploy a Java EE application:

See Also:

Oracle Fusion Middleware Deploying Applications to Oracle WebLogic Server for information about deploying using Oracle WebLogic Server Administration Console and for more information about using the WLST command line

4.4.1 Deploying Java EE Applications

You can deploy an application to a Managed Server or a cluster. This section describes how to deploy an application to a Managed Server.

To deploy a Java EE application to a Managed Server:

  1. From the navigation pane, expand the farm, then WebLogic Domain, and then the domain.

  2. Select the server in which you want to deploy the application.

    The server home page is displayed.

  3. From the WebLogic Server menu, select Application Deployment, then Deploy.

    The Deployment Wizard, Select Archive page is displayed, as shown in the following figure:

    Description of j2ee_deploy.gif follows
    Description of the illustration j2ee_deploy.gif

  4. In the Archive or Exploded Directory section, you can select one of the following:

    • Archive is on the machine where this browser is running. Enter the location of the archive or click Browse to find the archive file.

    • Archive or exploded directory is on the server where Enterprise Manager is running. Enter the location of the archive or click Browse to find the archive file.

  5. In the Deployment Plan section, you can select one of the following:

    • Create a new deployment plan when deployment configuration is done.

    • Deployment plan is on the machine where this web browser is running. If you select this option, enter the path to the plan.

    • Deployment plan is on the server where Enterprise Manager is running. If you select this option, enter the path to the plan.

  6. Click Next.

    The Select Target page is displayed.

  7. Select the target to which you want to deploy the application. The Administration Server, Managed Servers, and clusters are listed. You can select a cluster, one or more Managed Server in the cluster, or a Managed Server that is not in a cluster. Although the Administration Server is shown in the list of targets, you should not deploy an application to it. The Administration Server is intended only for administrative applications such as the Oracle WebLogic Server Administration Console.

  8. Click Next.

    The Application Attributes page is displayed.

  9. In the Application Attributes section, for Application Name, enter the application name.

  10. In the Context Root of Web Modules section, if the Web module does not have the context root configured in the application.xml file, you can specify the context root for your application. The context root is the URI for the Web module. Each Web module or EJB module that contains Web services may have a context root.

  11. If the application's adf-config.xml file archive contains MDS configuration, the Target Metadata Repository section is displayed. It allows you to choose the repository and partition for this application:

    • To change the repository, click the icon next to the Repository Name. In the Metadata Repositories dialog box, select the repository and click OK.

    • To change the partition, enter the partition name in Partition Name. Oracle recommends that you create a new partition for each application. If you enter a name of a partition that does not exist, the partition is created.

  12. If the application's adf-config.xml file archive contains MDS configuration for an MDS shared repository, the Shared Metadata Repository section is displayed. It allows you to choose the repository and partition for this application.

  13. In the Distribution section, you can select one of the following:

    • Distribute and start application (servicing all requests)

    • Distribute and start application in admin mode (servicing only admin requests)

    • Distribute only

  14. Click Next.

    The Deployment Wizard, Deployment Settings page is displayed.

  15. On this page, you can perform common tasks before deploying your application or you can edit the deployment plan or save it to a disk. Depending on the type of application, you can:

    • Configure Web modules: This deployment task is available when you are deploying any application that includes a Web module. In most cases, this means the application contains a Web application deployment descriptor (web.xml or weblogic.xml); however, a Web module can also be identified by annotations in the Java code of the application.

      You can use this deployment task to set standard Web application deployment descriptor properties, such as:

      • Session Validation interval

      • Maximum age of session cookies

      Click Go to Task in the Configure Web Modules row. The Configure Web Modules page is displayed. Click Configure General Properties to view and edit the general configuration for the Web Module or Map Resource References to map the resource references.

    • Configure application security: This deployment task is available for all application types. However, the options available when you select this task vary depending on the existence of the following files in the application:

      • If it contains jazn-data.xml, the page displays the Application Policy Migration section.

      • If it contains cwallet.sso, the page displays the Application Credential Migration section.

      • If it contains both, the page displays both sections.

      For information about these settings, see "Deploying JavaEE and ADF Applications with Oracle Enterprise Manager" in the Oracle Fusion Middleware Application Security Guide.

      If the application contains neither jazn-data.xml or cwallet.sso, the Configure Application Security page displays the following options:

      • Deployment Descriptors Only: Use only roles and policies that are defined in the deployment descriptors.

      • Custom Roles: Use roles that are defined in the Administration Console; use policies that are defined in the deployment descriptor.

      • Custom Roles and Policies: Use only roles and policies that are defined in the Administration Console.

      • Advanced: Use a custom model that you have configured on the realm's configuration page.

      Click Go to Task in the Configure Application Security row.

    • Configure EJB modules: This deployment task is available for any application that includes an EJB module. In most cases, this means the application contains an EJB deployment descriptor (ejb-jar.xml or weblogic-ejb-jar.xml); however, an EJB module can also be identified by annotations in the Java code of the application.

      You can use this deployment task to set standard EJB deployment descriptor properties, such as:

      • The maximum number of beans in the free pool

      • The EJB network access point

      Click Go to Task in the Configure EJB modules row. The Configure EJB Modules page is displayed. Click Configure EJB Properties to view and edit the general configuration for the EJBs or Map Resource References to map the resource preferences.

    • Configure ADF Connections: This deployment task is available for applications that use ADF connections. You can modify the connection information for an external application.

      Click Go to Task in the Configure ADF Connections row. The Configure ADF Connections page is displayed, showing the current connection information. To modify a connection type, click the Edit icon for a particular row. For example, you can modify the connection information for an external application. For more information about ADF connections, see the Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

    • Configure persistence: This deployment task is available for applications that contain one or more persistence.xml files. Using this task, you can configure the Java Persistent API (JPA) persistence units for the application.

      You can view details about each persistence unit and define a Java Transaction API (JTA) data source or non-JTA data source for each persistence unit.

      Configuring the data sources for persistence units can be useful for applications that take advantage of Oracle TopLink. For more information, refer to the Oracle Fusion Middleware Developer's Guide for Oracle TopLink.

      For more information about how persistence units and the persistence.xml file can be used in Java EE applications, refer to the definition of Persistence Units in the Java EE 5 Tutorial on the Sun Developer Network Web site:

      http://java.sun.com/javaee/5/docs/tutorial/doc/bnbqw.html#bnbrj
      

    For a simple Java EE application, only the first three options may be displayed.

  16. Expand Deployment Plan.

    You can edit and save the deployment plan, if you choose. If you edit the deployment plan and change descriptor values, those changes are saved to the deployment plan. In addition, the following configurations are saved to the deployment plan:

    • Application attributes

    • Web module configuration

    • EJB configuration

    Application attributes related to MDS are stored in the file adf-config.xml. Application security attributes are stored in weblogic-application.xml.

    Fusion Middleware Control updates the relevant files and repackages the .ear file.

  17. Click Deploy.

    Fusion Middleware Control displays processing messages.

  18. When the deployment is completed, click Close.

To deploy an application to multiple servers at the same time, navigate to the domain. Then, from the WebLogic Domain menu, select Application Deployment, then Deploy. The deployment wizard displays a page where you can select the servers.

To deploy an application to a cluster, select the cluster. Then, from the Cluster menu, select Application Deployment, then Deploy.

WLST Command:

deploy(app_name, path [,targets] [,stageMode] [,planPath] [,options])

4.4.2 Undeploying Java EE Applications

You can undeploy an application or a specific version of an application from a WebLogic Server Managed Server instance or a cluster. This section describes how to undeploy an application from a Managed Server. If an application has been deployed to multiple servers, when you undeploy it using Fusion Middleware Control, the application is undeployed from all the servers.

To undeploy a Java EE application from a Managed Server:

  1. From the navigation pane, expand Application Deployments, then the application to undeploy.

    The application home page is displayed.

  2. From the Application Deployment menu, select Application Deployment, then Undeploy.

    The confirmation page is displayed.

  3. Click Undeploy.

    Processing messages are displayed.

  4. When the operation completes, click Close.

Alternatively, you can navigate to the domain, Managed Server, or cluster, then, from the target's menu, choose Application Deployment, then Undeploy. In the Select Application page, select the application you want to undeploy.

WLST Command:

undeploy(app_name, path [,targets] [,options])

4.4.3 Redeploying Java EE Applications

You can redeploy a new version of an updated application, redeploy the same version, or redeploy a non-versioned application. You can redeploy an application to a cluster or a Managed Server. This section describes how to redeploy an application to a Managed Server.

To redeploy a Java EE application to a Managed Server:

  1. From the navigation pane, expand the farm, then Application Deployments.

  2. Select the application.

    The application home page is displayed.

  3. From the Application Deployment menu, choose Application Deployment, and then Redeploy.

    The Select Application page is displayed.

  4. Click Next.

  5. In the Archive or Exploded Directory section, you can select one of the following:

    • Archive is on the machine where this browser is running. Then, enter the location of the archive or click Browse to find the archive file.

    • Archive or exploded directory is on the server where Enterprise Manager is running. Then, enter the location of the archive or click Browse to find the archive file.

  6. In the Deployment Plan section, you can select one of the following:

    • Create a new deployment plan when deployment configuration is done.

    • Deployment plan is on the machine where this web browser is running. Enter the path to the plan or click Browse to find the plan file.

    • Deployment plan is on the server where Enterprise Manager is running. Enter the path to the plan or click Browse to find the plan file.

  7. Click Next.

    The Application Attributes page is displayed.

  8. Click Next.

    The Deployment Wizard, Deployment Settings page is displayed.

  9. On this page, you can perform common tasks before deploying your application or you can edit the deployment plan or save it to a disk. Depending on the type of application, you can:

    • Configure Web modules

    • Configure application security

    • Configure EJB modules

    • Configure ADF connections

    • Configure persistence

    For a simple Java EE application, only the first three options may be displayed.

  10. Expand Deployment Plan.

    You can edit and save the deployment plan, if you choose. If you edit the deployment plan and change descriptor values, those changes are saved to the deployment plan. In addition, the following configurations are saved to the deployment plan:

    • Application attributes

    • Web module configuration

    • EJB configuration

    Application attributes related to MDS are stored in the file adf-config.xml. Application security attributes are stored in weblogic-application.xml.

    Fusion Middleware Control updates the relevant files and repackages the .ear file.

  11. Click Redeploy.

    Processing messages are displayed.

  12. When the operation completes, click Close.

To redeploy an application to a cluster, select the cluster. Then, from the target's menu, select Application Deployment, then Redeploy.

WLST Command:

redeploy(app_name [,planpath] [,options])

4.5 Managing Deployment Plans

A deployment plan is a client-side aggregation of all the configuration data needed to deploy an archive into Oracle WebLogic Server. A deployment plan allows you to easily deploy or redeploy an application using a saved set of configuration settings.

A new deployment plan is created by default if you do not apply an existing deployment plan to an application at the time of deployment, as described in Section 4.4.1. Once created, you can save a deployment plan as a file and reuse it for redeploying the application or for deploying other applications.

However, if you change the configuration of an application after it is deployed (for example, if you modify the MDS configuration of an application), then any existing deployment plans you saved no longer represent the configuration settings of the deployed application.

In such a situation, you can fetch a new deployment plan that more closely represents the configuration of the deployed application.

To fetch the deployment plan of an application that is currently deployed:

  1. From the navigation pane, expand the farm, then WebLogic Domain.

  2. Select the domain.

    The WebLogic Domain page is displayed.

  3. From the WebLogic Domain menu, choose Application Deployment, then Fetch Deployment Plan.

    The Fetch Deployment Plan page is displayed.

  4. Select an application from the list of currently deployed applications.

  5. Select a location where you want to save the deployment plan, and click Fetch.

    You can save the plan to the computer where the Web browser is running or to the computer where Fusion Middleware Control is running.

  6. In the resulting dialog box, specify a directory location for the saved deployment plan.

    You can now use this deployment plan to later deploy or redeploy the application using the configuration currently in use by the application.

Alternatively, you can edit a deployment plan on the Deployment Settings page of the Application Deployment wizard.

4.6 Learn More

For more information about the topics covered in this chapter, see: