8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23ai | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » 10g » Here

OC4J Notes for Oracle AS10g

This is a rather random assortment of notes relating to OC4J. These typically refer to standalone instances, but some may be relevant to the OC4J in full AS10g installations also.

Related articles.


Some of the top-level tasks you are likely to perform are done using the opmnctl utility. The following command are used to start and stop all components.

# Startup
$ORACLE_HOME/opmn/bin/opmnctl startall

# Shutdown
$ORACLE_HOME/opmn/bin/opmnctl stopall

Individual components, or groups of components can be started or stopped as follows.

# Startup
$ORACLE_HOME/opmn/bin/opmnctl startproc ias-component="HTTP_Server"
$ORACLE_HOME/opmn/bin/opmnctl startproc process-type="home"

# Shutdown
$ORACLE_HOME/opmn/bin/opmnctl stopproc ias-component="HTTP_Server"
$ORACLE_HOME/opmn/bin/opmnctl stopproc process-type="home"

The debug option allows you to display an assortment of information about the installation.

# Debug
$ORACLE_HOME/opmn/bin/opmnctl debug

Creating and Removing Instances

The createinstance and removeinistance commands are located in the "$ORACLE_HOME/bin/" directory. Their names suggest their functions.

# Create a new instance.
$ORACLE_HOME/bin/createinstance -instanceName my_oc4j -protocol http -httpPort 7781
Creating OC4J instance "my_oc4j"...
Set OC4J administrator password for "my_oc4j" (password text will not be displayed as it is entered):
Enter password:
Confirm password:
A new OC4J instance "my_oc4j" is created in the group "default_group".

# Remove an existing instance.
$ORACLE_HOME/bin/removeinstance -instanceName my_oc4j
Removing OC4J instance "my_oc4j"...
The OC4J instance "my_oc4j" is removed from the group "default_group".

Identify OC4J Ports

$ $ORACLE_HOME/opmn/bin/opmnctl status -l

Processes in Instance: as_oc4j.example.com
ias-component                    | process-type       |     pid | status   |        uid |  memused |    uptime | ports
ASG                              | ASG                |     N/A | Down     |        N/A |      N/A |       N/A | N/A
OC4JGroup:default_group          | OC4J:home          |    9750 | Alive    | 1806795914 |   252928 | 643:34:00 | jms:12412,ajp:12413,rmis:12411,rmi:12410
HTTP_Server                      | HTTP_Server        |    9749 | Alive    | 1806795913 |   264768 | 643:33:41 | https1:4443,http2:7201,http1:7779


Deployer URI

Most things you try to do require the deployer URI. This is in the following form.


The RMI port for the relevant OC4J instance is shown in the output from the previous command. To validate the URI, use the following command, substituting the appropriate oc4jadmin password.

$ cd $ORACLE_HOME/j2ee/home
$ java -jar admin_client.jar deployer:oc4j:myserver.example.com:12410 oc4jadmin <password> -validateURI 
URI deployer:oc4j:myserver.example.com:12410 is valid and connected

Basic Admin Tasks

Some basic admin tasks using the deployer URI and the oc4jadmin password are shown below.

$ cd $ORACLE_HOME/j2ee/home
$ java -jar admin_client.jar deployer:oc4j:myserver.example.com:12410 oc4jadmin <password> -deploy \
  -file /tmp/myApplication.ear -deploymentName MyApp -bindAllWebApps

$ java -jar admin_client.jar deployer:oc4j:myserver.example.com:12410 oc4jadmin <password> -listApplications

$ java -jar admin_client.jar deployer:oc4j:myserver.example.com:12410 oc4jadmin <password> -start myApplication

Reset OC4J Admin Password

Stop everything.

$ORACLE_HOME/opmn/bin/opmnctl stopall

Edit the "$ORACLE_HOME/j2ee/home/config/system-jazn-data.xml" file, replacing the existing credentials with your new password (prefixed by !). If the "user" tag includes a "deactivated="true"" attribute, remove it. The final entry should look something like that below.

  <display-name>OC4J Administrator</display-name>
  <description>OC4J Administrator</description>

Remove any cached passwords.

rm $ORACLE_HOME/j2ee/home/persistence/ascontrol/ascontrol/securestore/*

Start everything up.

$ORACLE_HOME/opmn/bin/opmnctl startall

The password will automatically be encrypted in the config file.

Enable the OC4J AS Control

Edit the "$ORACLE_HOME/j2ee/home/config/default-web-site.xml" file, removing the "ohs-routing="false"" setting on the ascontrol application.

# Before
<web-app application="ascontrol" load-on-startup="true" name="ascontrol" ohs-routing="false" root="/em"/>
# After 
<web-app application="ascontrol" load-on-startup="true" name="ascontrol" root="/em"/>

Edit the "$ORACLE_HOME/j2ee/home/config/server.xml" file, setting the "start" parameter to "true" for the ascontrol application.

# Before
<application name="ascontrol" path="../../home/applications/ascontrol.ear" parent="system" start="false" />
# After
<application name="ascontrol" path="../../home/applications/ascontrol.ear" parent="system" start="true" />

Restart everything.

$ORACLE_HOME/opmn/bin/opmnctl stopall
$ORACLE_HOME/opmn/bin/opmnctl startall

Changing OC4J Ports

Check the port settings in the "$ORACLE_HOME/j2ee/home/config/server.xml" file. If any are wrong, so the following.

Stop everything.

$ORACLE_HOME/opmn/bin/opmnctl stopall

Edit the "$ORACLE_HOME/j2ee/home/config/server.xml" file, setting the correct values.

Start OPMN.

$ORACLE_HOME/opmn/bin/opmnctl start

Reload OPMN configuration.

$ORACLE_HOME/opmn/bin/opmnctl reload

Start everything.

$ORACLE_HOME/opmn/bin/opmnctl startall


$ cd $ORACLE_HOME/j2ee/home
$ java -jar admin_client.jar -help

   java -jar admin_client.jar <connection_uri> <username> <password> <command>

Valid commands are:

 -deploy -file <filename> -deploymentName <appname> [options]
 -redeploy -file <filename> -deploymentName <appname> [options]
 -undeploy <appname> [options]
 -bindWebApp -appName <appname> -webModuleName <name> [options]
 -unbindWebApp -appName <appname> -webModuleName <name> [options]
 -bindAllWebApps -appName <appname> [options]
 -unbindAllWebApps -appName <appname> [options]
 -start <appname>
 -stop <appname> [-timeout <time in seconds>] [-graceful true|false]
 -restartApp <appname> [-timeout <time in seconds>] [-graceful true|false]
 -listApplications [-verbose]
 -listWebBindings [-webSiteName <web-site-name>] [-verbose]
 -updateEJBModule -appName <appname> -ejbModuleName <name> -file <path>
 -describeSharedLibrary -name <name> -version <version>
 -publishSharedLibrary -name <name> -version <version> [options]
 -modifySharedLibrary -name <name> -version <version> [options]
 -removeSharedLibrary -name <name> -version <version>
 -addImportSharedLibrary -appName <app> -name <name> [options]
 -deleteImportSharedLibrary -appName <app> -name <name>
 -addRemoveInheritedSharedLibrary -appName <app> -name <name>
 -deleteRemoveInheritedSharedLibrary -appName <app> -name <name>
 -script <filename>

 -addDataSourceConnectionPool  -name <name> -factoryClass <factoryClass>
                              -dbUser <user> -dbPassword <password> -url <url> [options]
 -removeDataSourceConnectionPool -name <name>
 -addManagedDataSource -name <name> -jndiLocation <jndiLocation>
                          -connectionPoolName <connectionPoolName> [options]
 -removeManagedDatasource -name <dataSourceName>
 -addNativeDataSource -name <name>  -dbUser <user> -dbPassword <password>
                         -jndiLocation <jndiLocation> -loginTimeout <loginTimeout>
                         -dataSourceClass <dataSourceClass> -url <url> [options]
 -removeNativeDataSource -name <name>
 -testDatabaseConnection -factoryClass <factoryClass> -dbUser <dbUser> -dbPassword <dbPassword>
                         -url <url> -sqlStatement <sqlStatement>
 -testDataSource -datasourceName <datasourceName> -sqlStatement <sqlStatement>
 -testDataSourceConnectionPool -name <name> -sqlStatement <sqlStatement>

 -addJMSConnectionFactory -domain <domain> -jndiLocation <jndiLocation> [options]
 -removeJMSConnectionFactory -jndiLocation <jndiLocation>
 -addDestination -domain <domain> -name <name> -jndiLocation <jndiLocation> [options]
 -removeDestination -name <name> [options]

 -addWebSite -webSiteName <site-name> -protocol <protocol> -port <port> [options]

Valid connection_uris are:
1. To target all OC4J instances that belongs to an OC4J group in an Oracle Application Server Cluster:

2. To target a specific OC4J instance within a cluster:

3. To target a standalone OC4J server:

opmnPort is the OPMN request port specified in opmn.xml.
If omitted, defaults to 6003.

For detailed help on a particular command, use:
[java -jar admin_client.jar -usage <command>]


For more information see:

Hope this helps. Regards Tim...

Back to the Top.