Oracle® Containers for J2EE Configuration and Administration Guide
10g Release 3 (10.1.3) Part No. B14432-01 |
|
![]() Previous |
![]() Next |
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 restart and stop OC4J, deploy applications and gather information on current resource usage.
This chapter includes the following topics:
The admin.jar
utility is installed by default in ORACLE_HOME/j2ee/home
in a standalone OC4J instance.
Note that OC4J must be started before this utility can be used. Also note that the utility cannot be used to start OC4J, although it can be used to stop and then restart an instance.
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
Note that 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 |
---|---|
oc4jHost :oc4jOrmiPort
|
The host name and port of the OC4J server on which you are invoking admin.jar .
The The OC4J default port for the ORMI protocol is <rmi-server port="oc4jOrmiPort" host="oc4jHost" /> |
adminId adminPassword
|
The OC4J administration user name and password. The user name for the default administrator account is oc4jadmin .
|
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/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 that the value of the checkForUpdates
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.
Usage 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 |
---|---|
-deploy
|
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 |
-bindWebApp
|
Binds a Web application to the specified Web site and root.
This option creates an entry in the |
-undeploy appName
|
Removes the deployed J2EE application from the OC4J instance. The value of appName is the name of the application within OC4J, as defined in an application element within ORACLE_HOME/j2ee/home/config/server.xm l.
Undeploying an application results in the following:
|
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 and 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 |
---|---|
-application appName -start
|
Starts the specified application and any child applications. |
-application appName -stop
|
Stops the specified application and any child applications. |
-application appName -restart
|
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 his/her development environment.
The syntax is as follows:
java -jar admin.jar ormi://oc4jHost
:oc4jOrmiPort adminId adminPassword -applicationappName
-updateEJBModulerelativePath
[-filepath/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 $OC4J_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 |
---|---|
-application appName -updateEJBModule
|
Updates the specified EJB module with new EJBs.
|
The -site
option enables you to configure new Web sites, including secure sites, for use by applications deployed into OC4J. You can also retrieve a list of existing sites; test existing sites; and update or remove existing sites.
The syntax of the -add
option, which configures a new site, is as follows:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId
adminPassword -site -add [-host hostName] -port port -display-name name [-virtual-hosts hostNames] [-secure [true|false]] [-factory class] [-keystore path] [-storepass password] [-provider class] [-needs-client-auth [true|false]]
For example, the following command structure configures a new Web site on port 8899
with two virtual hosts:
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -site -add -host www1.acme.com -port 8899 -display-name MyServer -virtual-hosts MyServer.com,MyServer2.com
The next example configures a secure Web site to receive HTTPS requests on port 4443
. See "Configuring a Secure Web Site in OC4J" for instructions on creating secure Web sites.
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -site -add -host www1.acme.com -port 8899 -display-name MySecureSite -secure true -factory com.evermind.ssl.JSSESSLServerSocketFactorykeystore -keystore ../../server.keystore -storepass password -provider com.sun.net.ssl.internal.ssl.Provider -needs-client-auth true
Table 7-7 Options for Web Site Administration
-site options | Description |
---|---|
-site -add
|
Installs a new Web site. Supply information with the following subswitches:
|
-site -remove
|
Removes an existing Web site. Supply the host and port of this Web site in the following subswitches:
|
-site -test
|
Tests an existing Web site. Supply the host and port of the Web site to be tested, in the following subswitches:
|
-site -list
|
Lists all existing Web sites configured within the OC4J instance. |
-site -update
|
Updates an existing Web site. Supply information with the following subswitches:
|
Use admin.jar
to create, remove, list or test data sources for a specific application. You can also convert a pre-Oracle Application Server 10g Release 3 (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-8 Options for Data Source Management
Option | Description |
---|---|
-application appName -installDataSource
|
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-9 Options for Application and Data Source Management
Option | Description |
---|---|
-application appName -listDataSource
|
Retrieves the statically configured information about each installed data source object. |
-application appName -testDataSource
|
Tests an existing data source. Supply information with the following subswitches:
|
-application appName -removeDataSource
|
Removes an existing data source. Supply information with the following subswitch:
|
The -convertDataSourceConfiguration
option converts a pre-Release 3 (10.1.3) data-sources.xml
file to the new file format.
The syntax is as follows:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -convertDataSourceConfiguration legacyFileName convertedFileName
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 may be needed for reference. After the "new" file has been generated, copy it into the directory containing the legacy file.
Note that the generated data-sources.xml
file may include JNDI entries that are not needed but are transferred from the legacy file. Edit the file to remove these entries.
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-11 Options for Application Deployment
Option | Description |
---|---|
-deployconnector
|
Deploys a connector. Supply application information in the following subswitches:
|
-undeployconnector
|
Undeploys the specified connector.
Note that if you are undeploying a standalone RAR, the |