Oracle® Containers for J2EE Configuration and Administration Guide 10g (10.1.3.1.0) Part Number B28950-01 |
|
|
View PDF |
OC4J provides a command-line utility called admin.jar
that can be used to perform operations on an active OC4J instance in a standalone OC4J installation. Among other things, you can use this utility to stop and restart OC4J, deploy applications, and gather information on current resource usage.
This chapter includes the following topics:
Note: The OC4J web-site-related options (accessible with the-site command) that were provided in the admin.jar utility in previous releases are no longer available. For information on how to create and manage OC4J web site configurations, see Chapter 13, "Managing Web Sites in OC4J". |
The admin.jar
utility is installed by default in ORACLE_HOME
/j2ee/home
in a standalone OC4J instance.
OC4J must be started before this utility can be used, except for converting data sources, as "Converting Existing Data Sources to the New Configuration" describes. Also, the utility cannot be used to start OC4J, although it can be used to stop and then restart an instance, as "Stopping and Restarting OC4J in a Standalone Environment" describes.
This section covers the following topics:
Note: Theadmin.jar utility can be used only to manage a single OC4J instance in a standalone OC4J installation.
Use Oracle Process Manager and Notification Server (OPMN) to manage OC4J instances running as components of Oracle Application Server. Due to its more advanced capabilities, the |
The admin.jar
utility uses the following syntax. The parameters are described in Table 7-1.
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword options
As an example, the following command will force a graceful shutdown of the OC4J server. The value supplied for oc4jOrmiPort
is the default, 23791
. The user name supplied for adminId
is the user name for the default administrator account, oc4jadmin
.
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -shutdown
Some of these commands include an -application
switch that takes the name of the application to affect. The value is the name of the specific application to affect, as defined within the appropriate <application>
element in the server.xml
configuration file.
Table 7-1 Setting the Host and Login Information
Parameter | Description |
---|---|
|
The host name and port number for the OC4J server on which you are invoking The The OC4J default port for the ORMI protocol is <rmi-server port="oc4jOrmiPort" host="oc4jHost" /> |
|
The OC4J administration user name and password. The user name for the default administrator account is |
To print the online help text for the admin.jar
commands to the console, simply type -help
after oc4jHost
:
oc4jOrmiPort adminId adminPassword
. For example:
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -help
This section outlines the functionality provided by admin.jar
for managing an OC4J server. It includes the following sections:
You can use admin.jar
to shut down a standalone instance of the OC4J server and then restart it.
The following command forces a shutdown of the OC4J server, which terminates all threads immediately. The string entered as the reason
for the shutdown is written to the server log file, ORACLE_HOME
/j2ee/home/log/server.log
.
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -shutdown force need_to_reboot_host_machine
Table 7-2 Options for OC4J Server Shutdown and Restart
You can force OC4J to check the server directory structure for modified files and reload any that have changed, using the -updateConfig
option.
Note: The value of thecheckForUpdates flag must be set to either all or adminClientOnly (the default setting) to use this feature. See Oracle Containers for J2EE Deployment Guide for details on the checkForUpdates flag. |
You can use admin.jar
to deploy or undeploy J2EE applications to or from a standalone OC4J instance.
Notes:
|
Deploying an application is a two-step process: You must first deploy the archive into OC4J, then bind the Web module to the Web site that will be used to access the application.
The -deploy
command is first used to deploy the application:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -deploy -file path/filename -deploymentName appName -targetPath deploy_dir
Once the archive is deployed, the -bindWebApp
command is used to bind a Web application to the Web site it will be accessed through:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -bindWebApp appName webAppName webSiteName contextRoot
For example, the following command deploys the utility
application into OC4J:
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -deploy -file utility.ear -deploymentName utility
Next, the following example binds the utility
application and its utility-web
Web module to the default
OC4J Web site:
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -bindwebapp utility utility-web default-web-site /utility
Table 7-4 Options for Application Deployment
Option | Description |
---|---|
|
Deploys an application. Supply relevant information using the following subswitches:
The deployed EAR file is also copied to this directory. Each successive deployment will cause this EAR file to be overwritten.
The default directory is
You can optionally specify the path and filename of the JAR to output the generated stubs to. Otherwise, copies of the stubs will be output to an archive named Note that the java -DGenerateIIOP=true -jar oc4j.jar |
|
Binds a Web application to the specified Web site and root.
This option creates an entry in the |
|
Removes the deployed J2EE application from the OC4J instance. The value of Undeploying an application results in the following:
The optional |
This section outlines the functionality provided by admin.jar
for managing applications in a standalone OC4J instance. It includes the following sections:
You can use admin.jar
to start, stop, or restart an application that has been stopped in a standalone OC4J instance.
The following example restarts a specific application running on OC4J. If a file within the application has been modified, the application or module will be automatically redeployed.
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -application myapplication -restart
Table 7-5 Options for Application Restart
Option | Description |
---|---|
|
Starts the specified application and any child applications. |
|
Stops the specified application and any child applications. |
|
Restarts the specified application and any child applications. If OC4J polling is enabled and a file within the application has been modified, the application will be redeployed. |
The admin.jar
utility includes an -updateEJBModule
option that allows incremental or partial redeployment of EJB modules within an application running in an OC4J instance. This option is primarily intended to be used by an application developer to redeploy the JAR file directly from a development environment.
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" in the Oracle Containers for J2EE Deployment Guide. |
The syntax follows:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -application appName -updateEJBModule relativePath [-file path/ejbJarName]
For example, the following commands can be used to update the customerEjb.jar
module of the petstore
application. Assume the following directory structure on the developer's machine:
/work /src - application source code /build - compiled class files /dist - assembled EAR and JAR files
If the updated EJB JAR is in the /dist
directory, in a location matching the relative path defined in the application's application.xml
J2EE standard deployment descriptor, the following command could be issued from the /dist
directory:
java -jar $ORACLE_HOME/admin.jar ormi://myoc4jserver:23791 oc4jadmin password -application petstore -updateEJBModule customerEjb.jar
If the updated file is located within the /build
directory, the following command specifying the JAR location in the -file
option can be issued from the /dist
directory:
java -jar admin.jar ormi://myoc4jserver:23791 oc4jadmin password -application petstore -updateEJBModule customerEjb.jar -file build/customerEjb.jar
Table 7-6 Options for Updating an EJB Module
Option | Description |
---|---|
|
Updates the specified EJB module with new EJBs.
|
Use admin.jar
to create, remove, list or test data sources for a specific application. You can also convert a pre-10.1.3 data-sources.xml
file to the new file format.
The syntax of the -installDataSource
option, which configures a new application-specific data source, is as follows:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -application appName -installDataSource -jar path -url url -location jndiName [-pooledLocation jndiName] [-xaLocation jndiName] [-ejbLocation jndiName] -username name -password password [-connectionDriver className] -className className [-sourceLocation jndiName][-xaSourceLocation jndiName]
An example follows:
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -application myapp -installDataSource -jar C:/jdbc/lib/ojdbc14dms.jar -url jdbc:oracle:thin:@dev2:1521:main -location jdbc/OracleUddi -username dbuser -password dbpw -className oracle.jdbc.pool.OracleDataSource
Table 7-7 Options for Data Source Management
Option | Description |
---|---|
|
Installs a new data source for the specified application. Supply data source information within the following subswitches:
|
You can use admin.jar
to list, test or even delete data sources tied to a specific application.
Table 7-8 Options for Application and Data Source Management
Option | Description |
---|---|
|
Retrieves the statically configured information about each installed data source object. |
|
Tests an existing data source. Supply information with the following subswitches:
|
|
Removes an existing data source. Supply information with the following subswitch:
|
The OC4J 10g (10.1.3.1.0) implementation understands the 10.1.3 and the pre-10.1.3 (10.1.2 and 9.0.4) formats of the data-sources.xml
file. For an application that was previously used in a pre-10.1.3 OC4J implementation and contains its own data-sources.xml
file, the OC4J 10g (10.1.3.1.0) implementation automatically converts the data-sources.xml
file from the pre-10.1.3 format to the 10.1.3 format when you use the Application Server Control Console to change anything in the data-sources.xml
file, such as modifying an existing data source or creating or deleting a data source.
The -convertDataSourceConfiguration
option of the admin.jar
command converts a pre-10.1.3 data-sources.xml
file to the new file format.
With an active OC4J instance in a standalone environment, you can use admin.jar
with the following syntax to manually convert a pre-10.1.3 data-sources.xml
file to the 10.1.3 format.
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -convertDataSourceConfiguration old-data-sources.xml new-data-sources.xml
For example, the following command converts an existing configuration and writes it to a new file:
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -convertDataSourceConfiguration C:\oc4j\j2ee\home\config\data-sources.xml C:\new\data-sources.xml
Ideally, you should rename the old data-sources.xml
after the conversion, rather than delete it, as it contains information that might be needed for reference. After the new file has been generated, copy it into the directory containing the legacy file.
In the syntax, the ORMI URL is optional. You can specify an ORMI URL only when OC4J is running.
You can also convert a data-sources.xml
file before deployment, without a running OC4J instance. The syntax for this offline conversion is as follows:
java -jar admin.jar -convertDataSourceConfiguration
old-data-sources.xml new-data-sources.xml
Notes:
|
After conversion, whether manual or automatic, visually inspect the new data-sources.xml
file to confirm that there is consistency between your application and the new file regarding the JNDI location used to refer to a data source.
This consistency check is advisable because the new file may contain data source definitions that are not used, which happens because the old format uses multiple location attributes (such as location
, ejb-location
, and xa-location)
. The conversion to the new 10.1.3 format creates a separate data source in the new data-sources.xml
file corresponding to each location attribute specified in the old data-sources.xml
file. In most cases, client applications will use only the data source defined by either the location
or ejb-location
attribute. The converted data-sources.xml
file may have definitions that are not used by the applications and can be removed from the file.
For examples of the new data-sources.xml
format, see the "Data Sources" chapter of the Oracle Containers for J2EE Services Guide.
You can use one of the following commands to deploy or undeploy a Java Connector Architecture-compliant resource adapter packaged in a RAR file.
Table 7-9 Options for Application Deployment
Option | Description |
---|---|
|
Deploys a connector. Supply application information in the following subswitches:
|
|
Undeploys the specified connector.
Undeploying a standalone RAR does not require a restart of the |