Oracle® Containers for J2EE Configuration and Administration Guide 10g (10.1.3.1.0) Part Number B28950-01 |
|
|
View PDF |
This chapter provides instructions for installing OC4J, as well as for starting, stopping, and restarting an OC4J instance. It includes the following sections:
You can start an OC4J server instance in a standalone environment using the default configuration with one of the oc4j
command scripts or the executable oc4j.jar
archive.
To start OC4J using an oc4j
script, issue the following command from the ORACLE_HOME
/bin
directory:
oc4j -start
Before you can use this command, the ORACLE_HOME
and JAVA_HOME
environment variables must be set. See "Meeting Installation Prerequisites for a Standalone OC4J Server" for details.
To start OC4J by invoking oc4j.jar
, issue the following command from the ORACLE_HOME
/j2ee/home
directory:
java -jar oc4j.jar [args]
Invoking oc4j.jar
as shown above starts OC4J using the default server.xml
configuration file, which you can find in the j2ee/home/config
directory. To start OC4J using a nondefault version of the server.xml
file, issue the following command. You must supply the path to the modified configuration file.
java -jar oc4j.jar -config /yourpath/server.xml [args]
You can pass in arguments at startup to set runtime options in OC4J. For an overview of valid arguments, see "Setting OC4J Runtime Options at Startup". You can also view the console help by issuing the following command from the ORACLE_HOME
/j2ee/home
directory:
java -jar oc4j.jar -help
You can also set system properties on the JVM through the oc4j.jar
command line at OC4J startup. For details on setting system properties, see "Setting System Properties at Startup".
In a managed configuration, all Oracle Application Server components, including OC4J and Oracle HTTP Server, must be started using OPMN, either from the Cluster Topology page in the Application Server Control Console or with opmnctl
, the OPMN command-line tool. This tool is installed in the ORACLE_HOME
/opmn/bin
directory.
Use the following command to start all OPMN-managed processes, including OC4J, on a local Oracle Application Server instance:
opmnctl startall
Use the following command to start a specific managed processes, in this case OC4J, on a local Oracle Application Server instance:
opmnctl startproc ias-component=default_group
In a cluster topology that includes multiple OC4J instances, if the EARs that the OC4J instances will use are in a shared directory at a single location, you should start the instances with the -sequential
flag:
opmnctl startproc ias-component=default_group -sequential
This option prevents resource contention that might occur if you started all the OC4J instance in parallel.
Alternatively, to start the OC4J instances sequentially, you can specify the sequential
option in opmn.xml
, the OPMN configuration file for the cluster, as follows:
<ias-component id="default_group"> <process-type id="home" module-id="OC4J" status="enabled"> <module-data> <category id="start-parameters"> <data id="oc4j-options" value="-sequential" </category> ... </module-data> </process-type> </ias-component>
For more information about opmnctl
commands, see the Oracle Process Manager and Notification Server Administrator's Guide.
You can stop a standalone OC4J server by invoking the -shutdown
command in the admin_client.jar
or admin.jar
command-line utility or an oc4j.cmd
or oc4j
executable script.
Note: You should not use operating system commands such asControl-C on a Windows system or kill on a UNIX or Linux system to stop OC4J.
This is especially true when applications utilizing EJBs are actively running within OC4J, as such commands do not allow EJB method calls or timer operations to complete before shutting down the server. |
To stop OC4J using admin_client.jar
, issue the following command:
java -jar admin_client.jar uri adminId adminPassword -shutdown
For example:
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin password -shutdown
This command shuts down the entire OC4J server, terminating all threads immediately, as if the host machine were unplugged. If you use this command, the current state for clustered applications will not be replicated.
For descriptions of the uri
, adminId
, and adminPassword
variables, see "Understanding the admin_client.jar Syntax and URI Specification".
On a standalone OC4J instance, the -shutdown
option of admin_client.jar
is equivalent to the -shutdown force
option of the admin.jar
utility, which"Stopping OC4J with admin.jar" describes.
To stop OC4J using admin.jar
, issue the following command:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -shutdown [ordinary|force] [reason]
You can specify the following options:
[ordinary | force]
The type of shutdown. The default is ordinary
, which allows each thread to terminate normally.
The force
option terminates all threads immediately. It is essentially the same as unplugging the host machine. If this option is used, the current state for clustered applications will not be replicated.
[
reason
]
You can optionally specify a reason for the shutdown as a string that is written to the ORACLE_HOME
/j2ee/home/log/server.log
file. Spaces are not allowed in the string.
The following example forces a shutdown of the OC4J server using admin.jar
, which terminates all threads immediately. The string entered as the reason
for the shutdown is written to the ORACLE_HOME
/j2ee/home/config/server.log
file.
java -jar admin.jar ormi://localhost:23791 oc4jadmin password -shutdown force need_to_reboot_host_machine
To stop OC4J using one of the oc4j
scripts, issue the following command from the ORACLE_HOME
/bin
directory. You must supply the ORMI port used by OC4J, which is 23791
by default, as well as the password for the oc4jadmin
account.
oc4j -shutdown -port oc4jOrmiPort -password adminPassword
For example:
oc4j -shutdown -port 23791 -password adminpwd
The ORACLE_HOME
and JAVA_HOME
environment variables must be set to use this command. See "Meeting Installation Prerequisites for a Standalone OC4J Server" for details.
In a managed configuration, you can stop an OC4J instance from the Cluster Topology page of the Application Server Control Console, with opmnctl
, the OPMN command-line tool, or with the admin_client.jar
command-line utility, which notifies OPMN that the instance has been stopped. The OPMN tool is installed in the ORACLE_HOME
/opmn/bin
directory. The admin_client.jar
utility is installed by default in the ORACLE_HOME
/j2ee/
instance
directory.
Use the following command to stop all OPMN-managed processes, including OC4J, on a local Oracle Application Server instance:
opmnctl stopall
You can use the following command to stop a specific managed component, in this case OC4J, on a local Oracle Application Server instance:
opmnctl stopproc ias-component=default_group
For more information about opmnctl
commands, see the Oracle Process Manager and Notification Server Administrator's Guide.
Alternatively, you can use admin_client.jar
to stop an OC4J instance, with the following command:
java -jar admin_client.jar uri adminId adminPassword -shutdown
For example:
java -jar admin_client.jar deployer:oc4j:opmn://localhost/home oc4jadmin password -shutdown
This command shuts down the entire OC4J instance, terminating all threads immediately. For an OPMN-managed OC4J instance, admin_client.jar
notifies OPMN that the server is being shut down on purpose, to prevent OPMN from attempting to restart it. If you use this command, the current state for clustered applications will not be replicated.
For descriptions of the uri
, adminId
, and adminPassword
variables, see "Understanding the admin_client.jar Syntax and URI Specification".
You can use the admin_client.jar
utility to restart a standalone OC4J server, with the following command:
java -jar admin_client.jar uri adminId adminPassword -restart
For example:
java -jar admin_client.jar deployer:oc4j:localhost oc4jadmin password -restart
For descriptions of the uri
, adminId
, and adminPassword
variables, see "Understanding the admin_client.jar Syntax and URI Specification".
Alternatively, you can use the admin.jar
command-line utility to restart an OC4J instance, with the following command:
java -jar admin.jar ormi://oc4jHost:oc4jOrmiPort adminId adminPassword -restart [reason]
You can enter a string as the value for [
reason
]
. The string is written to the ORACLE_HOME
/j2ee/home/config/server.log
file.
In a managed configuration, you can restart OC4J from the Cluster Topology page of the Application Server Control Console, with opmnctl
, the OPMN command-line tool, or with the admin_client.jar
command-line utility. The OPMN tool is installed in the ORACLE_HOME
/opmn/bin
directory. The admin_client.jar
utility is installed by default in the ORACLE_HOME
/j2ee/
instance
directory.
You can use the following command to restart all OPMN-managed processes, including OC4J, on a local Oracle Application Server instance:
opmnctl startall
Alternatively, you can use the following command to restart a specific managed process, in this case OC4J, on a local Oracle Application Server instance:
opmnctl restartproc ias-component=default_group
In a cluster topology that includes multiple OC4J instances, you should restart the instances with the opmnctl
command and -sequential
flag:
opmnctl startproc ias-component=default_group -sequential
The -sequential
flag prevents resource contention that might occur if you started all the OC4J instance in parallel, especially if the EARs that the OC4J instances will use are in a shared directory at a single location. If the opmn.xml
configuration file for the cluster includes the sequential
option, as described in "Starting OC4J in an Oracle Application Server Environment", you need not specify the -sequential
flag.
You can use admin_client.jar
to restart an OC4J instance, with the following command:
java -jar admin_client.jar uri adminId adminPassword -restart
For descriptions of the uri
, adminId
, and adminPassword
variables, see "Understanding the admin_client.jar Syntax and URI Specification".