Skip Headers
Oracle® Containers for J2EE Deployment Guide
10g (10.1.3.4.0)

Part Number E12289-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

10 Using OC4J Ant Tasks for Deployment

OC4J provides a set of Ant tasks for performing deployment-related operations on a specific OC4J instance or simultaneously on all OC4J instances in a group. In Oracle Application Server 10g Release 3 (10.1.3.4.0), a group is a synchronized set of OC4J instances that belong to the same cluster topology, which is two or more loosely connected Oracle Application Server nodes.

This chapter describes the Ant tasks and provides guidelines for integrating them into your application build process. With OC4J Ant tasks, you can perform the following operations on an OC4J instance or group of OC4J instances:

Table 10-1 lists the OC4J ant tasks with references to their descriptions.

Table 10-1 OC4J Ant Tasks

Ant Task Name Description

addDataSourceConnectionPool

"Adding a Data Source Connection Pool"

addDestination

"Adding a JMS Destination"

addJMSConnectionFactory

"Adding a JMS Connection Factory"

addManagedDataSource

"Adding a Managed Data Source"

addNativeDataSource

"Adding a Native Data Source"

bindWebApp

"Binding a Specific Web Module to a Web Site and Setting the Context Root"

bindAllWebApps

"Binding All Web Modules to a Single Web Site"

compileJsp

"Using an Ant Task to Precompile a JSP" in the Oracle Containers for J2EE Support for JavaServer Pages Developer's Guide

deploy

"Deploying a J2EE Application (EAR)"

"Deploying a Standalone Web Module (WAR)"

"Deploying a Standalone Resource Adapter (RAR)"

getDataSourcesDescriptor

"Getting the Data Sources Descriptor for an Application"

getDestinations

"Getting Information About JMS Destinations"

getJMSConnectionFactories

"Getting Information About JMS Connection Factories"

publishSharedLibrary

"Installing a Shared Library"

modifySharedLibrary

"Modifying an Existing Shared Library"

redeploy

"Redeploying an Archive"

removeDataSourceConnectionPool

"Removing a Data Source Connection Pool"

removeDestination

"Removing a JMS Destination"

removeJMSConnectionFactory

"Removing a JMS Connection Factory"

removeManagedDataSource

"Removing a Managed Data Source"

removeNativeDataSource

"Removing a Native Data Source"

removeSharedLibrary

"Removing a Shared Library"

restartServer

"Restarting and Stopping OC4J Instances"

shutdownServer

"Restarting and Stopping OC4J Instances"

start

"Starting, Restarting, and Stopping Applications"

stop

"Starting, Restarting, and Stopping Applications"

testDatabaseConnection

"Testing a Database Connection"

testDataSource

"Testing a Data Source"

testDataSourceConnectionPool

"Testing a Data Source Connection Pool"

undeploy

"Undeploying an Archive"

updateEJBModule

"Updating Modified Classes in a Deployed EJB Module"


You can perform similar deployment tasks with Application Server Control or the admin_client.jar command-line utility. Chapter 9, "Using Application Server Control for Deployment" describes how to use the Application Server Control for deployment. Chapter 11, "Using the admin_client.jar Utility for Deployment" explains how to use admin_client.jar for deployment tasks.

This chapter includes the following sections:

Note:

The OC4J Ant tasks discussed in this chapter are intended to be used with Apache Ant version 1.6.5.

See the following link to access the most recent Apache Ant product documentation:

http://ant.apache.org/manual/

You can also use OC4J Ant tasks to deploy Web applications through Eclipse, as "Using Ant Tasks from the OC4J Administration Client with Eclipse" describes.

Preparing to Use OC4J Ant Tasks

This section provides prerequisites and guidelines for using OC4J Ant tasks. It includes the following topics:

Meeting Prerequisites for Using OC4J Ant Tasks

The following prerequisites are required to use the deployment-related OC4J Ant tasks that this document describes:

  • Ant version 1.6.5 or later

    Ant 1.6.5 is installed with OC4J in the ORACLE_HOME/ant directory structure.

  • An ORACLE_HOME environment variable set to the OC4J installed directory

  • A JAVA_HOME environment variable set to the location of the Java2 Standard Edition SDK

For information about setting these environment variables, see the Oracle Containers for J2EE Configuration and Administration Guide.

Incorporating OC4J Ant Tasks into Your Environment

The OC4j installation includes Ant 1.6.5 and the files for the OC4J Ant tasks. Before you can use the Ant tasks, you need to incorporate them into your environment.

The ant-oracle.jar file is installed by default within the ORACLE_HOME/ant/lib directory. The following Ant-related files are installed with OC4J in the ORACLE_HOME/j2ee/utilities directory:

  • ant-oracle-classes.jar

    A JAR file containing the compiled Ant task classes

  • A properties file, ant-oracle.properties, that you can edit to specify execution properties for the Ant tasks

  • ant-oracle.xml

    An XML file that you can import into the Ant build file (build.xml) using the Ant <import> task. This is necessary only if ant-oracle.jar is not installed in the ORACLE_HOME/ant/lib directory.

Perform the following procedure to set up your build environment for using the Ant 1.6.5 implementation, which is installed with OC4J by default in ORACLE_HOME/ant:

  1. Add ORACLE_HOME/ant/bin to the system PATH environment variable.

  2. Declare the oracle namespace in the <project> element in the Ant build file (build.xml). The OC4J Ant tasks will be referenced in build.xml using this namespace. For example:

    <project name="test" default="all" basedir="."
      xmlns:oracle="antlib:oracle">
    
  3. (OPTIONAL) Copy the ant-oracle.properties file from the ORACLE_HOME/j2ee/utilities directory to the directory containing your build file (build.xml).

    Although you can modify the file in ORACLE_HOME/j2ee/utilities and reference it from your build scripts, it is better to maintain the original file as a template.

  4. (OPTIONAL) Set the values for arguments to pass to the Ant tasks in the ant-oracle.properties file.

    The properties within the file are set to the OC4J default values. The file also reads in environment variable settings, such as ORACLE_HOME and JAVA_HOME. You can edit any of these properties as necessary to reflect the configuration of the target OC4J instance or instances.

  5. (OPTIONAL) If you copied the ant-oracle.properties file to your build directory, you must reference it in the build script (build.xml). For example:

    <property file="ant-oracle.properties"/>
    

Incorporating OC4J Ant Tasks Using Ant 1.6.5 Outside OC4J

This section outlines the procedure for setting up your build environment to use the Ant 1.6.5 implementation outside OC4J.

  1. Add ANT_HOME/ant/bin to the system PATH environment variable.

  2. Set the ANT_HOME environment variable to point to your Ant installation and the JAVA_HOME environment variable to point to the location of the Java2 Standard Edition SDK.

    The common ANT installation directory is ORACLE_HOME/ant.

  3. Declare the oracle namespace in the <project> element in the Ant build file (build.xml). The OC4J Ant tasks will be referenced in build.xml using this namespace.

    <project name="test" default="all" basedir="."
      xmlns:oracle="antlib:oracle">
    
  4. Copy the ant-oracle.properties file from the ORACLE_HOME/j2ee/utilities directory to the directory containing your build file (build.xml).

    Although you can modify the file in ORACLE_HOME/j2ee/utilities and reference it from your build scripts, it is better to maintain the original file as a template.

  5. Set the values for arguments to pass to the Ant tasks in the ant-oracle.properties file.

    The properties within the file are set to the OC4J default values. The file also reads in environment variable settings, such as for ORACLE_HOME and JAVA_HOME. You can edit any of these properties as necessary to reflect the configuration of the target OC4J instance or instances.

  6. Copy the ant-oracle.xml file from the ORACLE_HOME/j2ee/utilities directory to the directory containing your build file (build.xml).

  7. At the top level of your build file, add this <import> element:

    <import file="ant-oracle.xml"/>
    

Incorporating OC4J Ant tasks Using Ant 1.6.5 with the Administrative Client Utility

The Administrative Client Utility enables you to use OC4J Ant tasks for configuration and deployment.

To incorporate OC4J Ant tasks using Ant 1.6.5 with the Administrative Client Utility:

  1. Download the oc4j_admin_client_101340.zip file from the Oracle Technology Network at

    http://www.oracle.com/technology/software/products/ias/htdocs/utilsoft.html
    

    For information about the Administrative Client Utility and how to use it, see "Downloading and Extracting the Remote Administration Client".

  2. Extract the contents of oc4j_admin_client_101340.zip into a local directory of your choice, such as oc4j_admin_client.

  3. Copy the ORACLE_HOME/ant/lib/ant-oracle.jar file from an Oracle Application Server 10g (10.1.3.4.0) home directory to OC4J_ADMIN_CLIENT_DIR\ant\lib, in the local directory to which you extracted the contents of oc4j_admin_client_101340.zip.

  4. Set the ORACLE_HOME environment variable to the OC4J_ADMIN_CLIENT_DIR directory.

  5. Add ANT_HOME/ant/bin to the system PATH environment variable.

  6. Set the ANT_HOME environment variable to point to your Ant installation and the JAVA_HOME environment variable to point to the location of the Java 2 Standard Edition SDK.

    The common ANT installation directory is ORACLE_HOME/ant.

  7. Declare the oracle namespace in the <project> element of the Ant build file (build.xml)., as follows:

    <project name="test" default="all" basedir="." 
      xmlns:oracle="antlib:oracle"> 
    

    References to the OC4J Ant tasks in build.xml will use this namespace.

  8. Copy the ant-oracle.properties file from the ORACLE_HOME/j2ee/utilities directory to the directory containing your build file (build.xml).

    Although you can modify the file in ORACLE_HOME/j2ee/utilities and reference it from your build scripts, it is better to maintain the original file as a template.

  9. Set the values for arguments to pass to the Ant tasks in the ant-oracle.properties file.

    The properties within this file are set to the OC4J default values. The file also reads in environment variable settings, such as for ORACLE_HOME and JAVA_HOME. You can edit any of these properties as necessary to reflect the configuration of the target OC4J instance or instances.

  10. Copy the ant-oracle.xml file from the ORACLE_HOME/j2ee/utilities directory to the directory containing your build file (build.xml).

  11. At the top level of your build file, add this <import> element:

    <import file="ant-oracle.xml"/>
    

Setting the Deployer URI

The key attribute passed to an Ant task is deployerUri, which specifies the OC4J target for the task. The syntax for the URI varies depending on the target.

For the format of this URI, see the following topics:

Invoking a Task on a Group of OC4J Instances

Use the following URI to specify all OC4J instances in a group as the deployment target. A group is a synchronized set OC4J instances that belong to the same cluster topology. For example, you could specify default_group as the target to perform a deployment operation simultaneously on all OC4J instances that belong to the default group (named default_group) in a cluster.

The URI utilizes the OPMN-based clustering framework. You need to supply only the host name and, optionally, an OPMN request port for any Oracle Application Server node within the cluster. The application is then able to retrieve the host names and OPMN ports for all other nodes within the cluster.

The URI syntax follows:

deployer:cluster:[rmis]:opmn://host[:opmnPort]/groupName

For example:

deployer:cluster:opmn://node1/default_group

Table 10-2 URI Parameters for Targeting a Group

Parameter Description

rmis

Optional. Include if the target utilizes ORMI over SSL, or ORMIS.

host

Required. The host name of an Oracle Application Server node within a cluster. Any node can be specified; the list of other nodes in the cluster will be retrieved from this node.

opmnPort

Optional. The OPMN request port, as specified in opmn.xml. If not specified, the default port, 6003, will be used.

groupName

Required. The name of the group to which the target OC4J instances belong.


Invoking a Task on a Specific OC4J Instance

Use the following URI to target a specific OPMN-managed OC4J instance, including an instance within a cluster. In the prefix of the URI, oc4j replaces cluster.

Specify the host name for the Oracle Application Server node hosting the instance. If you are not sure of the host name or port for the node, you can specify the host name for another node within the cluster, as well as the name of the Oracle Application Server instance. The application will then use the OPMN clustering framework to locate the node hosting the Oracle Application Server instance.

The URI syntax follows:

deployer:oc4j:[rmis]:opmn://host[:opmnPort]/[iASInstanceName]
/oc4jInstanceName

For example:

deployer:oc4j:opmn://server.company.com:6015/instance2/oc4j_2

Table 10-3 URI Parameters for Targeting a Specific Instance

Parameter Description

rmis

Optional. Include if the target utilizes ORMI over SSL, or ORMIS.

host

Required. The host name of the Oracle Application Server node to target within the cluster.

opmnPort

Optional. The OPMN request port, as specified in opmn.xml. If not specified, the default port 6003 will be used.

iASInstanceName

Optional. The name of the Oracle Application Server instance to target, if it does not reside on the node specified for host.

oc4jInstanceName

Required. The name of the target OC4J instance.


Invoking a Task on a Standalone OC4J Server

Use one of the following URIs to target a standalone OC4J server instance.

If you are using RMI, the URI syntax is as follows:

deployer:oc4j:host:rmiPort

If you are using ORMI over SSL (ORMIS), the URI syntax is as follows:

deployer:oc4j:rmis:host:ormisPort

For example:

deployer:oc4j:myserver:23791
deployer:oc4j:rmis:myserver:23943

Table 10-4 URI Parameters for Targeting Standalone OC4J

Parameter Description

rmis

Required if the target utilizes ORMI over SSL, or ORMIS.

host

Required. The host name for the standalone OC4J server.

rmiPort

Required if RMI is used. The RMI port, as specified in the instance-specific rmi.xml file.

ormisPort

Required if ORMIS is used. The SSL port, as specified in the instance-specific rmi.xml file.


Enabling Java Logging

You can enable Java logging to help troubleshoot errors that occur when running the Ant tasks. Log messages will be output to the console.

To enable logging:

  1. Create an ANT_OPTS environment variable and set the value to -Djava.util.logging.config.file=logging.properties before running the Ant tasks.

  2. Create a logging.properties file containing a single line:

    oracle.oc4j.admin.jmx.client.CoreRemoteMBeanServer.level=INFO
    

    If you create this file in a location other than ORACLE_HOME/ant/bin, you must include the path to the file in the ANT_OPTS environment variable.

You can set the value in the logging.properties file to one of the Java log-level values, which Table 10-5 describes.

Table 10-5 Java Log Levels

Java Log Level Description
SEVERE

Log system errors requiring attention from the system administrator.

WARNING

Log actions or a conditions discovered that should be reviewed and might require action before an error occurs.

INFO

Log normal actions or events. This could be a user operation, such as "login completed" or an automatic operation such as a log file rotation.

CONFIG

Log configuration-related messages or problems.

FINE

Log trace or debug messages used for debugging or performance monitoring. Typically contains detailed event data.

FINER

Log fairly detailed trace or debug messages.

FINEST

Log highly detailed trace or debug messages.


For example:

oracle.oc4j.admin.jmx.client.CoreRemoteMBeanServer.level=FINE

In OC4J 10g (10.1.3.4.0), you can set the log levels for loggers with Application Server Control, as follows:

  1. On the OC4J Home page, click Administration.

  2. From the administration tasks, select Logger Configuration to display the Logger Configuration page.

  3. Click Expand All to view the entire list of loggers currently loaded for the OC4J instance.

  4. Select a log level for any of the loggers shown on the page.

Invoking OC4J Ant Tasks

You invoke the deployment-related Ant tasks provided with OC4J through the build file (build.xml). Each task is specified in a <target> element in the build file, in a subelement formatted as <oracle:taskName. ... />. In the subelement, oracle is the namespace used to reference the OC4J Ant tasks.

The following sample build.xml file contains a single deploy task. This task will deploy the specified EAR to a standalone OC4J server.

<project name="test" default="deploy" basedir="." xmlns:oracle="antlib:oracle">
    <property name="lib.dir" value="/scratch//temp"/>
    <property name="app.name" value="hello-planet"/>
    <property name="deployer.uri" value="deployer:oc4j:localhost:23791"/>
    <property name="oc4j.admin.user" value="oc4jadmin"/>
    <property name="oc4j.admin.password" value="password"/>
    ...
  <target name="deploy-ear" depends="setup,check-oc4j-available>
   <echo message="-----> Deploying the application module deployment (ear) file"/>
   <oracle:deploy deployerUri="${deployer.uri}"
                  userid="${oc4j.admin.user}" 
                  password="${oc4j.admin.password}"
                  file="${lib.dir}/${app.name}.ear" 
                  deploymentName="${app.name}"
                  bindAllWebApps="default-web-site"
                  logfile="${log.dir}/deploy-ear.log"/>  </target>
  ...
</project>

Deploying an Archive

The following sections describe how to invoke the deploy task:

Deploying a J2EE Application (EAR)

Use the deploy task to deploy a J2EE application packaged in an EAR file to an OC4J instance or to a group of OC4J instances. The following example shows the attributes typically supplied to deploy an EAR file:

<oracle:deploy 
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
file="${lib.dir}/${app.name}.ear"
deploymentName="${app.name}"
bindAllWebApps="default-web-site"
deploymentPlan="localPath/filename"
logfile="${log.dir}/deploy-ear.log"/>

Table 10-6 summarizes the attributes that you can set for the deploy task when you deploy an EAR file.

Table 10-6 deploy task Attributes for EAR Deployment

Attribute Description

deployerUri

Required.The URI specifying the deployment target.

userid

Required.The administrator user name for the target OC4J instance or group of instances.

password

Required.The administrator password for the target OC4J instance or group of instances.

file

Required.The path and file name of the archive to deploy.

deploymentName

Required.The user-defined application deployment name, used to identify the application within OC4J.

bindAllWebApps

Optional. Binds all Web modules to the specified Web site. Specify the name portion of the name_web-site.xml file that configures the Web site.

deploymentPlan

Optional. The path and file name for a deployment plan to apply to the application. The plan would have been saved during a previous deployment as an XML file. The file must exist on the local host.

parent

Optional. The parent application of this application. The default is the global, or default, application.

targetPath

Optional. The directory to deploy the EAR to. If not specified, the EAR is deployed to the ORACLE_HOME/j2ee/instance/applications directory by default.

The deployed EAR file is also copied to this directory. Each successive deployment will cause this EAR file to be overwritten.

deploymentDirectory

Optional. The directory containing the OC4J-specific deployment descriptors and generated files, such as compiled JSP classes and EJB wrapper classes.

The default directory is ORACLE_HOME/j2ee/instance/application-deployments/.

enableIIOP

Optional. Specify to generate IIOP client stubs on the OC4J server.

The application-level stubs generated for all EJB modules are output to an archive named _iiopClient.jar in the ORACLE_HOME/j2ee/instance/application-deployments/appName directory. In addition, stubs for each individual EJB module are generated in an archive with the same name in the ORACLE_HOME/j2ee/instance/application-deployments/appName/ejbModuleName directory.

The GenerateIIOP system property must be enabled at OC4J startup to use this feature. This property is set as -DGenerateIIOP=true on the OC4J command line for standalone OC4J or as an oc4j-options value in opmn.xml.

iiopClientJarPath

Optional. The path and file name of the JAR to output IIOP client stubs to.

The application-level stubs generated for all EJB modules are output to an archive named _iiopClient.jar in the ORACLE_HOME/j2ee/instance/application-deployments/appName directory. If a path is supplied, the archive is also set on this path.

In addition, stubs for each individual EJB module are generated in an archive with the same name in the ORACLE_HOME/j2ee/instance/application-deployments/appName/ejbModuleName directory.

The GenerateIIOP system property must be enabled at OC4J startup to use this feature. This property is set as -DGenerateIIOP=true on the OC4J command line for standalone OC4J or as an oc4j-options value in opmn.xml.

sequential

Optional. Specify to deploy the archive to each OC4J instance in a group in sequence. The deployment to each target OC4J instance must complete before deployment begins on the next target instance. Requests will not be routed to an OC4J instance while the EAR is being deployed to it.

You can use the sequentialDelay attribute to specify a number of seconds between deployments, as described in "Specifying a Delay Between Sequential Redeployments in a Cluster".

If this attribute is not specified, the archive will be simultaneously deployed to all OC4J instances in the target group by default.

This attribute is valid only in an Oracle Application Server environment. It is not valid for standalone OC4J.

sequentialDelay

Optional. Specifies a number of seconds between sequential deployments to different OC4J instances that are running an application cluster.

logfile

Optional. The path and file name for a log to be generated for the deployment.


Deploying a Standalone Web Module (WAR)

Use the deploy task to deploy a standalone Web module packaged in a WAR file to an OC4J instance or to a group of OC4J instances. For example:

<oracle:deploy
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
file="${lib.dir}/${app.name}.war"
deploymentName="${app.name}"
contextRoot="/myapp"
bindAllWebApps="default-web-site"
logfile="${log.dir}/deploy-war.log"/>

Table 10-7 summarizes the WAR-specific attributes that you can set for the deploy task when you deploy a WAR file.

Table 10-7 deploy Task Attributes for Standalone WAR Deployment

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

file

Required. The path and file name of the archive to deploy.

deploymentName

Required. The user-defined module deployment name, used to identify the module within OC4J.

bindAllWebApps

Required. Binds the Web module to the specified Web site. Specify the name portion of the name_web-site.xml file that configures the Web site.

contextRoot

Required. The Web module's context root, which will be appended to the URL used to access the application through a Web browser.

For example, if you supply /petstore as the context root, the module could be accessed with the following URL:

http://node1.company.com:7777/petstore

parent

Optional. The parent application of this module. The default is the global, or default, application.

targetPath

Optional. The directory to deploy the archive to. If not specified, the archive is deployed to the ORACLE_HOME/j2ee/instance/applications directory by default.

The deployed archive file is also copied to this directory. Each successive deployment will cause this file to be overwritten.

deploymentDirectory

Optional. The directory containing the OC4J-specific deployment descriptors and generated files, such as compiled JSP classes and EJB wrapper classes.

The default directory is ORACLE_HOME/j2ee/instance/application-deployments.

logfile

Optional. The path and name for a log file generated for the deployment.


Deploying a Standalone Resource Adapter (RAR)

Use the deploy task to deploy a standalone resource adapter packaged in an archive to an OC4J instance or to a group of OC4J instances. The following example shows the attributes typically supplied to deploy a standalone RAR file:

<oracle:deploy 
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
file="${lib.dir}/${app.name}.rar"
deploymentName="${app.name}"
grantAllPermissions="true"
logfile="${log.dir}/deploy-rar.log"/>

Table 10-8 summarizes the attributes that you can set for the deploy task when you deploy a RAR file.

Table 10-8 deploy Task Attributes for Standalone RAR Deployment

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

file

Required. The path and file name of the archive to deploy.

deploymentName

Required. The user-defined connector name, used to identify the connector within OC4J.

grantAllPermissions

Required if resource adapter needs runtime permissions. Include and set to true to grant all runtime permissions requested by the resource adapter, if required.

deploymentPlan

Optional. The path and file name for a deployment plan to apply to the application. The plan would have been saved during a previous deployment as an XML file. The file must exist on the local host.

nativeLibPath

Optional. The path to the directory containing native libraries (such as DLLs) within the RAR file.

logfile

Optional. The path and name for a log file generated for the deployment.


Binding Web Modules to a Web Site After Deployment

Every Web module deployed to OC4J must be bound to a Web site through which it will be accessed.

Typically, you will bind Web modules at the time an EAR file or WAR file is deployed using the bindAllWebApps attribute of the deploy task. However, if the bindAllWebApps attribute was not specified when the EAR or WAR was deployed, you can bind modules to a Web site after deployment, as the following topics describe:

Binding All Web Modules to a Single Web Site

Use the bindAllWebApps task to bind the Web modules within a previously deployed EAR to a specified Web site. For example:

<oracle:bindAllWebApps
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
deploymentName="${app.name}"
webSiteName="${oc4j.binding.module}"/>

Table 10-9 summarizes the attributes that you can set for the bindAllWebApps task.

Table 10-9 bindAllWebApps Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance.

password

Required. The administrator password for the target OC4J instance.

deploymentName

Required. The user-defined name of the application that the Web modules belong to, set when the application was deployed.

webSiteName

Required. The name portion of the name_web-site.xml file that contains the Web site configuration.


Binding a Specific Web Module to a Web Site and Setting the Context Root

Use the bindWebApp task to bind a specific Web module within a J2EE application to a Web site you specify or to the default Web site. You can also specify the context root that will be used to access the Web module. For example:

<oracle:bindWebApp
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
deploymentName="${app.name}"
webModule="${web.name}"
webSiteName="${oc4j.binding.module}"
contextRoot="/${context.root}"/>

Table 10-10 summarizes the attributes that you can set for the bindWebApp task.

Table 10-10 bindWebApp Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance.

password

Required. The administrator password for the target OC4J instance.

deploymentName

Required. The user-defined name of the application the Web module belongs to, set when the application was deployed.

webModule

Required. The name of the Web module to be bound to the Web site. This should be the name of the WAR file contained within the EAR file, without the .WAR extension.

webSiteName

Required. The name portion of the name_web-site.xml file that contains the Web site configuration.

contextRoot

Required. The context root for the Web module, such as /utility. This will be appended to the URL used to access the application through a Web browser; for example http://localhost:8888/utility.


Redeploying an Archive

Use the redeploy task to redeploy a previously deployed archive to an OC4J instance or to a group of OC4J instances. The isConnector="true" attribute must be included if you are redeploying a standalone resource adapter (RAR). The previous version of the archive will be undeployed as part of this process. For example:

<oracle:redeploy 
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
file="${lib.dir}/${app.name}.archiveType"
deploymentName="${app.name}"
keepsettings="true"
sequential="true"
logfile="${log.dir}/deploy-ear.log"/>

Table 10-11 summarizes the attributes that you can set for the redeploy task.

Table 10-11 redeploy Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

file

Required. The path and file name of the archive to redeploy.

deploymentName

Required. The user-defined application deployment name, used to identify the application within OC4J. This value must match the name of the existing application on the server.

isConnector

Required for a standalone RAR. Include and set to true if redeploying a standalone RAR.

keepsettings

Optional. If this attribute is specified, the redeployed application will fetch and use the deployment plan from the previous deployment. Values set in deployment descriptors packaged within the archive will be ignored.

If this attribute is not specified, values will be set to those in the deployment descriptors packaged with the archive.

sequential

Optional. Specify to redeploy the archive to each OC4J instance in a group of OC4J instances in sequence. The redeployment to each target OC4J instance must complete before redeployment begins on to the next target instance. Requests will not be routed to an OC4J instance while the archive is being redeployed to it.

You can use the sequentialDelay attribute to specify a number of seconds between redeployments, as described in "Specifying a Delay Between Sequential Redeployments in a Cluster".

If this attribute is not included, the archive will be simultaneously deployed to all OC4J instances in the group by default.

This option is valid only in a clustered environment. It is not valid for standalone OC4J.

sequentialDelay

Optional. Specifies a number of seconds between sequential redeployments to different OC4J instances that are running an application cluster.

logfile

Optional. The path and name for a log file generated for the deployment.


Specifying a Delay Between Sequential Redeployments in a Cluster

When an application is redeployed to a group with the sequential attribute of the redeploy Ant task, the redeployment operation is serialized, with redeployment done to one OC4J instance at a time so that the application being deployed is never entirely in a stopped state. In a sequential redeployment, the deployment manager immediately commences redeployment on the next OC4J instance that is running a member of an application cluster as soon as the redeployment operation completes on the current instance. The result is that the system might not be able to stabilize itself so that the new application instance is fully active before the next redeployment commences, which introduces these possible side effects:

  • The application can become inaccessible while it is stopped on one OC4J instance and before mod_oc4j is notified that the application is available on another instance.

  • Session replication activities might not have had an opportunity to execute.

In some circumstances, the session state of an application might be lost when you redeploy an application to a cluster with the redeploy task, even if you specify the sequential and keepsettings attributes.

In OC4J 10g (10.1.3.4.0), you can use the sequentialDelay attribute of the redeploy task to specify a number of seconds between redeployments to different OC4J instances that are running an application cluster. This delay can provide enough time for replication of session state.

If you specify the optional sequentialDelay attribute, the deployment manager waits the specified number of seconds between redeployment operations on OC4J instances within a group. This delay enables the system to stabilize as redeployment operations occur across the group, reducing the opportunities for applications to be inaccessible or session state to be lost.

An example of the redeploy Ant task with the sequentialDelay attribute follows:

<oracle:redeploy
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
file="${lib.dir}/${app.name}.archiveType"
deploymentName="${app.name}"
keepsettings="true"
sequential="true"
sequentialDelay="15"
logfile="${log.dir}/deploy-ear.log"/>

The sequentialDelay option also applies to the deploy Ant task.

Redeploying an Application with Scheduled Jobs

If you redeploy an application that has scheduled jobs, the jobs will not run as scheduled unless you remove all the jobs before the redeployment and resubmit them after it.

To redeploy an application with scheduled jobs:

  1. Remove all scheduled jobs.

  2. Redeploy the application.

  3. Resubmit all the jobs.

Undeploying an Archive

Use the undeploy task to remove an application or module from an OC4J instance or from a group of OC4J instances. The isConnector="true" attribute must be included if you are undeploying a standalone resource adapter (RAR). For example:

<oracle:undeploy
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
deploymentName="${app.name}"
logfile="${log.dir}/filename.log"/>

Table 10-12 summarizes the attributes that you can set for the undeploy task.

Table 10-12 undeploy Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

deploymentName

Required. The user-defined name of the application or module to undeploy. This is the name set when the archive was deployed.

isConnector

Required for a standalone RAR. Include and set to true if undeploying a standalone RAR.

logfile

Optional. The path and name for a log file generated for the deployment.


Updating Modified Classes in a Deployed EJB Module

Use the updateEJBModule task to perform incremental or partial redeployment of EJB modules within an application running in an OC4J instance or in a group of OC4J instances. This feature makes it possible to redeploy only those beans within an EJB JAR that have changed, without requiring redeployment of the entire module. For example:

<oracle:updateEJBModule
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
deploymentName="${app.name}"
ejbModuleName="${ejb.jar}"
file="${new.ejb.jar}"
logfile="${log.dir}/filename.log"/>

Note:

Incremental redeployment may be more efficient than redeploying the entire application for CMP or BMP entity beans but not for session beans, message-driven beans, or EJB 3.0 JPA entities. For details about whether to use this feature, see "Incremental Redeployment of Updated EJB Modules".

Table 10-13 summarizes the attributes that you can set for the updateEJBModule task.

Table 10-13 updateEJBModule Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

deploymentName

Required. The name of the application that the EJB module is part of. If you are updating a standalone EJB module, specify the default application.

ejbModuleName

Required. The name of the EJB JAR file to be updated as defined in application.xml.

file

Required. The path and file name of the updated EJB JAR.

logfile

Optional. The path and name for a log file generated for the update.


Creating and Managing Shared Libraries

You can use Ant tasks to create and manage shared libraries in an OC4J instance or in a group of OC4J instances, as the following topics describe:

Installing a Shared Library

Use the publishSharedLibrary task to install a shared library in an OC4J instance or in a group of OC4J instances. Once installed, the shared library will be available for use by applications within each instance. For example:

<oracle:publishSharedLibrary
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
libraryName="name"
libraryVersion="version"
logfile="${log.dir}/filename.log">
  <oracle:uploadCodeSource path="path/file" />
  <oracle:addCodeSource path="path/file" />
  <oracle:sharedLibraryImport libraryname="name" min-version="version" 
      max-version="version" />
</oracle:publishSharedLibrary>

The shared library binaries will be installed in the ORACLE_HOME/j2ee/instance/shared-lib directory within each OC4J instance. At the same time, a <shared-library> element declaring the shared library will be added to the server.xml file on each OC4J instance.

Include one element for each code source to upload or add. Do the same for each existing shared library to import.

  • To upload a new code source to each OC4J server, specify the path and file name of the JAR or ZIP archive file to upload in a nested <oracle:uploadCodeSource> element. The path can be absolute or relative to the current working directory.

  • To add a JAR or ZIP file that already exists on the server, specify the path and file name in an <oracle:addCodeSource> element. Specify an absolute or relative path pointing to the location of the existing file on each OC4J server. If a relative path is used, it will be interpreted as relative to ORACLE_HOME.

  • To import an existing shared library into the new shared library, specify the shared library name as defined within the OC4J instance or instances in an <oracle:sharedLibraryImport> element. You can specify the minimum or maximum version, or both, of the library to import.

The following example uploads two JAR files to each target OC4J server:

<oracle:publishSharedLibrary
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
libraryName="acme.common"
libraryVersion="2.5"
logfile="${log.dir}/filename.log">
  <oracle:uploadCodeSource path="/acme/acme-apis.jar" />
  <oracle:uploadCodeSource path="/acme/acmeImpl.jar" />
</oracle:publishSharedLibrary>

Table 10-14 summarizes the attributes that you can set for the publishSharedLibrary task.

Table 10-14 publishSharedLibrary Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

libraryName

Required. The name of the shared library.

In cases where common APIs are implemented by multiple vendors, the name should include both the vendor name and the name of the technology; for example, oracle.jdbc or xerces.xml.

libraryVersion

Required. The shared library version. This value should ideally reflect the code implementation version.

parentName

Optional. The name of the parent shared library, if applicable.

parentVersion

Optional. The parent shared library version, if applicable.

logfile

Optional. The path and name for a log file generated for the update.


Modifying an Existing Shared Library

Use the modifySharedLibrary task to make changes to an existing shared library installed in an OC4J instance or in a group of OC4J instances. For example:

<oracle:modifySharedLibrary
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
libraryName="name"
libraryVersion="version"
logfile="${log.dir}/filename.log">
  <oracle:uploadCodeSource path="path/file" />
  <oracle:removeCodeSource path="file" />
  <oracle:addCodeSource path="path/file" />
  <oracle:addImport libraryName="name" min-version="version" 
      max-version="version" />
  <oracle:removeImport libraryname="name" min-version="version" 
      max-version="version" />
</oracle:modifySharedLibrary>

Include one element for each code source to upload, add, or remove. Do the same for each existing shared library to import or remove.

  • To upload a new code source to each OC4J server, specify the path and file name of the JAR or ZIP archive file to upload in a nested <oracle:uploadCodeSource> element. The path can be absolute or relative to the current working directory.

  • To add a JAR or ZIP file that already exists on the server or servers, specify the path and file name in an <oracle:addCodeSource> element. Specify an absolute or relative path pointing to the location of the existing file on the OC4J server or servers. If a relative path is used, it will be interpreted as relative to ORACLE_HOME.

  • Use <oracle:removeCodeSource> to remove an existing code source from the shared library. Specify the file name of the code source within the shared library to remove.

  • To import an existing shared library into the shared library, specify the shared library name as defined within the OC4J instance or instances in an <oracle:addImport> element. You can optionally specify the minimum or maximum version, or both, of the library to import.

  • To remove an imported shared library, use an <oracle:removeImport> element.

The following example removes a code source and an imported library from the target shared library:

<oracle:modifySharedLibrary
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
libraryName="acme.common"
libraryVersion="2.5"
logfile="${log.dir}/filename.log">
  <oracle:removeCodeSource path="acme-apis.jar" />
  <oracle:removeImport libraryName="foo" min-version="2.0"/>
</oracle:modifySharedLibrary>

Table 10-15 summarizes the attributes that you can set for the modifySharedLibrary task.

Table 10-15 modifySharedLibrary Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group of instances.

password

Required. The administrator password for the target OC4J instance or group of instances.

libraryName

Required. The name of the shared library to modify.

libraryVersion

Required. The version of the shared library.

logfile

Optional. The path and name for a log file generated for the update.


Removing a Shared Library

Use the removeSharedLibrary task to remove a shared library from an OC4J instance or from a group of OC4J instances. For example:

<oracle:removeSharedLibrary
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
logfile="${log.dir}/filename.log" 
libraryName="name"
libraryVersion="version"/>

Table 10-16 summarizes the attributes that you can set for the removeSharedLibrary task.

Table 10-16 removeSharedLibrary Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or group.

password

Required. The administrator password for the target OC4J instance.

libraryName

Required. The name of the shared library.

libraryVersion

Required. The version of the shared library.

logfile

Optional. The path and name for a log file generated for the removal.


Starting, Restarting, and Stopping Applications

Use the start or stop task to start, restart, or stop an application and its child applications as part of a deployment operation on a specific OC4J instance or group of OC4J instances across an entire cluster. For example:

<oracle:start|stop
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"
deploymentName="${app.name}"/>

Table 10-17 summarizes the attributes that you can set for the start and stop tasks.

Table 10-17 start and stop Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or instances.

password

Required. The administrator password for the target OC4J instance or instances.

deploymentName

Required. The name of the application to start or stop.


Restarting and Stopping OC4J Instances

Use the restartServer or shutdownServer task to restart or stop a specific OC4J instance or a group of OC4J instances across an entire cluster. For example:

<oracle:restartServer|shutdownServer 
deployerUri="${deployer.uri}"
userid="${oc4j.admin.user}"
password="${oc4j.admin.password}"/>

Table 10-18 summarizes the attributes that you can set for the restartServer and shutdownServer tasks.

Table 10-18 restartServer and shutdownServer Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The administrator user name for the target OC4J instance or instances.

password

Required. The administrator password for the target OC4J instance or instances.


Managing Data Sources

You can use Ant tasks to manage data sources in an OC4J instance or in a group of OC4J instances, as the following topics describe:

Adding, Testing, and Removing Data Source Connection Pools

You can use Ant tasks to add, test, and remove data source connection pools in an OC4J instance or in a group of OC4J instances, as the following topics describe:

Adding a Data Source Connection Pool

Use the addDataSourceConnectionPool task to add a data source connection pool for an application in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:addDataSourceConnectionPool                                    
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"                               
name="ScottConnectionPool"                             
factoryClass="oracle.jdbc.pool.OracleDataSource"        
dbUser="scott"                                          
dbPassword="tiger"                                      
url="jdbc:oracle:thin:@localhost:1521:xe"/>

Table 10-19 summarizes the attributes that you can set for the addDataSourceConnectionPool task.

Table 10-19 addDataSourceConnectionPool Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

jndiLocation

Required. The location to use to bind the new data source connection pool into JNDI.

connectionPoolName

Required. The fully qualified path of the connection factory implementation.

dbUser

Required. The default user name for the new data source connection pool.

dbPassword

Required. The default password for the new data source connection pool.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application to deploy to.

loginTimeout

Optional. The login timeout for the new data source connection pool.

txLevel

Optional. The transaction level (local or global).

dbSchema

Optional. The database schema to use,

manageLocalTransactions

Optional. Indicates whether or not OC4J should manage local transactions. The default value is true.


Testing a Data Source Connection Pool

Use the testDataSourceConnectionPool task to test an application's connection to a data source connection pool in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:testDataSourceConnectionPool
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default" 
connectionPoolName="ScottConnectionPool" 
sqlStatement="select * from dual" />

Table 10-20 summarizes the attributes that you can set for the testDataSourceConnectionPool task.

Table 10-20 testDataSourceConnectionPool Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

connectionPoolName

Required. The name of the connection pool.

sqlStatement

Required. The SQL statement to use to test the connection

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application.

user

Optional. The user name to use.

password

Optional. The default password to use.


Removing a Data Source Connection Pool

Use the removeDataSourceConnectionPool task to remove a data source connection pool from an application in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:removeDataSourceConnectionPool
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"
name="ScottConnectionPool"/>

Table 10-21 summarizes the attributes that you can set for the removeDataSourceConnectionPool task.

Table 10-21 removeDataSourceConnectionPool Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

name

Required. The name of the connection pool.

logfile

Optional. The path and name for a log file generated for the removal.

applicationName

Optional. The name of the application from which to remove the data source connection pool.


Adding, Testing, and Removing Data Sources

You can use Ant tasks to add, test, and remove data sources in an OC4J instance or in a group of OC4J instances, as the following topics describe:

Adding a Managed Data Source

Use the addManagedDataSource task to add a managed data source for an application in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:addManagedDataSource
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"                               
dataSourceName="ScottDataSource"
jndiLocation="jdbc/ScottDataSource"
connectionPoolName="ScottConnectionPool" />

Table 10-22 summarizes the attributes that you can set for the addManagedDataSource task.

Table 10-22 addManagedDataSource Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

dataSourceName

Required. The name of the data source.

jndiLocation

Required. The location to use to bind the new data source into JNDI.

connectionPoolName

Required. The name of the connection pool with which the data source interacts.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application for which to add the data source.

dbUser

Optional. The default user name for the new data source.

dbPassword

Optional. The default password for the new data source.

loginTimeout

Optional. The login timeout for the new data source.

txLevel

Optional. The transaction level (local or global).

dbSchema

Optional. The database schema to use if the EJB CMP implementation being used is Orion CMP. (TopLink CMP is the default.)

manageLocalTransactions

Optional. Indicates whether or not OC4J should manage local transactions. The default value is true.


Removing a Managed Data Source

Use the removeManagedDataSource task to remove a managed data source from an application in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:removeManagedDataSource
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"
dataSourceName="ScottDataSource"/>

Table 10-23 summarizes the attributes that you can set for the removeManagedDataSource task.

Table 10-23 removeManagedDataSource Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

dataSourceName

Required. The name of the data source to remove.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application from which to remove the data source.


Adding a Native Data Source

Use the addNativeDataSource task to add a native data source for an application in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:addNativeDataSource
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"
dataSourceName="ScottNativeDataSource"
dbUser="scott"
dbPassword="tiger"
jndiLocation="jdbc/ScottNativeDataSource"
loginTimeout="60"
dataSourceClass="oracle.jdbc.pool.OracleDataSource"
url="jdbc:oracle:thin:@localhost:1521:xe"        >
<oracle:nativeDataSourceProperty name="maxStatements" value="20"/>
<oracle:nativeDataSourceProperty name="implicitCachingEnabled" value="30"/>
</oracle:addNativeDataSource>

Table 10-24 summarizes the attributes that you can set for the addNativeDataSource task.

Table 10-24 addNativeDataSource Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

dataSourceName

Required. The name of the new data source.

jndiLocation

Required. The location to use to bind the new data source into JNDI.

dbUser

Required. The default user for the new data source.

dbPassword

Required. The default password for the new data source.

dataSourceClass

Required. The fully qualified class of the new data source.

url

Required. The url used by the new data source to connect to the database.

<nativeDataSourceProperty>

 

name

Required. The name of a property for the new data source.

value

Required. The value of a property for the new data source.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application for which to add the data source.

loginTimeout

Optional. The login timeout for the new data source.


Removing a Native Data Source

Use the removeNativeDataSource task to remove a native data source from an application in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:removeNativeDataSource
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"
dataSourceName="ScottNativeDataSource"/>

Table 10-25 summarizes the attributes that you can set for the removeNativeDataSource task.

Table 10-25 removeNativeDataSource Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

dataSourceName

Required. The name of the data source to remove.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application from which to remove the data source.


Testing a Database Connection

Use the testDatabaseConnection task to test an application's connection to a database in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:testDatabaseConnection
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default"                               
sqlStatement="select * from dual"
factoryClass="oracle.jdbc.pool.OracleDataSource"
dbUser="scott"
dbPassword="tiger"
url="jdbc:oracle:thin:@localhost:1521:xe"/>

Table 10-26 summarizes the attributes that you can set for the testDatabaseConnection task.

Table 10-26 testDatabaseConnection Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

sqlStatement

Required. The SQL statement to use to test the connection.

factoryClass

Required. The JDBC factory to test (instance of Driver, DataSource, ConnectionPoolDataSource, or XADataSource).

dbUser

Required. The default user name for the database.

dbPassword

Required. The default password for the database.

url

Required. The URL to set on the JDBC factory.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application for which to test the database connection.


Testing a Data Source

Use the testDataSource task to test an application's connection to a data source in an OC4J instance or in each OC4J instance of a group within a cluster. For example:

<oracle:testDataSource
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default" 
dataSourceName="ScottDataSource"
sqlStatement="select * from dual" />

Table 10-27 summarizes the attributes that you can set for the testDataSource task.

Table 10-27 testDataSource Task Attributes

Attribute Task

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

datasourceName

Required. The data source to test.

sqlStatement

Required. The SQL statement to use to test the connection.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application for which to test the data source.

dbUser

Optional. The default user name for the data source.

dbPassword

Optional. The default password for the data source.


Getting the Data Sources Descriptor for an Application

Use the getDataSourcesDescriptor task to retrieve an application's data sources descriptor. For example:

<oracle:getDataSourcesDescriptor
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
applicationName="default" />

Table 10-28 summarizes the attributes that you can set for the getDataSourcesDescriptor task.

Table 10-28 getDataSourcesDescriptor Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

logfile

Optional. The path and name for a log file generated for the deployment.

applicationName

Optional. The name of the application to which the descriptor belongs.


Managing JMS Resources

You can use OC4J Ant tasks to manage data JMS resources in an OC4J instance or in a group of OC4J instances, as the following topics describe:

Managing JMS Connection Factories

You can use Ant tasks to manage the OC4J JMS connection factories, as the following topics describe:

Adding a JMS Connection Factory

Use the addJMSConnectionFactory task to add a JMS connection factory to an OC4J instance or to each instance of a group within a cluster. For example:

<oracle:addJMSConnectionFactory
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
domain="Queue"
jndiLocation="jms/ExampleQueueCF" />

Table 10-29 summarizes the attributes that you can set for the addJMSConnectionFactory task.

Table 10-29 addJMSConnectionFactory Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

domain

Required. The JMS domain of this connection factory (`QUEUE', `TOPIC', or `UNIFIED').

jndiLocation

Required. The JNDI location to which this connection factory will be bound.

logfile

Optional. The path and name for a log file generated for the deployment.

host

Optional. The host name associated with this connection factory (defaults to the containing OC4J JMS server host).

port

Optional. The port number associated with this connection factory (defaults to the containing OC4J JMS server port).

jmsUser

Optional. The user name associated with this connection factory (defaults to anonymous).

jmsPassword

Optional. The password associated with this connection factory (defaults to null).

clientID

Optional. The JMS client ID associated with this connection factory (defaults to null).

isXA

Optional. Whether or not this an XA connection factory (defaults to false).


Removing a JMS Connection Factory

Use the removeJMSConnectionFactory task to remove a JMS connection factory from an OC4J instance or instances. For example:

<oracle:removeJMSConnectionFactory
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
jndiLocation="jms/ExampleQueueCF" />

Table 10-30 summarizes the attributes that you can set for the removeJMSConnectionFactory task.

Table 10-30 removeJMSConnectionFactory Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

jndiLocation

Required. The JNDI location of the connection factory to remove.

logfile

Optional. The path and name for a log file generated for the deployment.


Getting Information About JMS Connection Factories

Use the getJMSConnectionFactories task to return the attributes for each of the JMS connection factories in an OC4J instance or in a group of OC4J instances within a cluster. For example:

<oracle:getJMSConnectionFactories
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1" />

Table 10-31 summarizes the attributes that you can set for the getJMSConnectionFactories task.

Table 10-31 getJMSConnectionFactories Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

logfile

Optional. The path and name for a log file generated for the deployment.


Managing JMS Destinations

You can use Ant tasks to manage the OC4J JMS destinations, as the following topics describe:

Adding a JMS Destination

Use the addDestination task to add a JMS destination. For example:

<oracle:addDestination
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"domain="Queue"
name="ExampleQueue"
jndiLocation="jms/ExampleQueue" />

Table 10-32 summarizes the attributes that you can set for the addDestination task.

Table 10-32 addDestination Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

domain

Required. The JMS domain of this destination (`QUEUE' or `TOPIC').

name

Required. The OC4J JMS provider-specific name of the destination.

jndiLocation

Required. The JNDI location to which this destination will be bound.

logfile

Optional. The path and name for a log file generated for the deployment.

persistenceFile

Optional. The persistence file associated with this destination (defaults to null).

description

Optional. A textual description of this destination (defaults to null).


Removing a JMS Destination

Use the removeDestination task to remove a JMS destination from an OC4J instance or from each OC4J instance of a group within a cluster. For example:

<oracle:removeDestination
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1"
jndiLocation="jms/ExampleQueue" />

Table 10-33 summarizes the attributes that you can set for the removeDestination task.

Table 10-33 removeDestination Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

name

Required. The OC4J JMS provider-specific name of the destination to remove.

logfile

Optional. The path and name for a log file generated for the deployment.


Getting Information About JMS Destinations

Use the getDestinations task to return the attributes for each of the OC4J JMS destinations in an OC4J instance or in a group of OC4J instances within a cluster. For example:

<oracle:getDestinations
deployerUri="deployer:oc4j:localhost"
userid="oc4jadmin"
password="welcome1" />

Table 10-34 summarizes the attributes that you can set for the getDestinations task.

Table 10-34 getDestinations Task Attributes

Attribute Description

deployerUri

Required. The URI specifying the deployment target.

userid

Required. The default user name to use to get connections.

password

Required. The default password to use to get connections.

logfile

Optional. The path and name for a log file generated for the deployment.