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.
- opmnctl
- Creating and Removing Instances
- Identify OC4J Ports
- Deployer URI
- Basic Admin Tasks
- Reset OC4J Admin Password
- Enable the OC4J AS Control
- Changing OC4J Ports
- Help
Related articles.
opmnctl
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.
deployer:oc4j:<hostname>:<rmi-port>
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.
<user> <name>oc4jadmin</name> <display-name>OC4J Administrator</display-name> <guid>84FC02F0DE1611E08F4BE14DF3B938DE</guid> <description>OC4J Administrator</description> <credentials>!Mypassword123</credentials> </user>
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
Help
$ cd $ORACLE_HOME/j2ee/home
$ java -jar admin_client.jar -help
Usage:
java -jar admin_client.jar <connection_uri> <username> <password> <command>
Valid commands are:
-shutdown
-restart
-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>
-listSharedLibraries
-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>
-validateURI
-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>
-getDataSourcesDescriptor
-listDataSources
-listDataSourceConnectionPools
-addJMSConnectionFactory -domain <domain> -jndiLocation <jndiLocation> [options]
-removeJMSConnectionFactory -jndiLocation <jndiLocation>
-getJMSConnectionFactories
-addDestination -domain <domain> -name <name> -jndiLocation <jndiLocation> [options]
-removeDestination -name <name> [options]
-getDestinations
-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:
deployer:cluster:[ormis:]opmn://opmnHost[:opmnPort]/oc4jGroupName
2. To target a specific OC4J instance within a cluster:
deployer:oc4j:[ormis:]opmn://opmnHost[:opmnPort]/oc4jInstanceName
deployer:oc4j:[ormis:]opmn://opmnHost[:opmnPort]/asInstanceName/oc4jInstanceName
3. To target a standalone OC4J server:
deployer:oc4j:oc4jHost:rmiPort
deployer:oc4j:ormis:oc4jHost:ormisPort
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...
![]() |

