Monday, July 20, 2009

How to change the JAVA version used to run a specific OC4J instance

1. Using Application Server Control Web Interface

Overview
--------
(a) Ensure the Application Server Control web application is running
and accessible from a browser.
(b) Access the Application Server Control application, drill down to
the configuration pages for the desired OC4J instance and enter
the path of the desired java executable as the "Java Executable"
value under "Command Line Options".
(d) Reload opmn using "opmnctl reload" so that it can pick up the
configuration changes.
(e) Start/Restart the desired OC4J instance with the new java executable
in place.

Detailed Approach
-----------------
(a) Ensure the Application Server Control web application is running
and accessible from a browser.

Identify the correct Application Server Control port (typically 1810).
The port can be determined by inspecting the file:

${ORACLE_HOME}/install/portlist.ini

which contains an entry similar to:

[Ports]
Oracle HTTP Server port = 7777
:
:
Application Server Control port = 1810

Access the appropriate URL for the Application Server Control:

http://yourHost.your.domain:1810/

and login as the ias_admin user with the ias_admin password provided
at installation time.

(b) Using Application Server Control application, drill down to
the configuration pages for the desired OC4J instance and enter
the path of the desired java executable as the "Java Executable"
value under "Command Line Options".

Under the "Home" tab of the main page, identify the desired OC4J
instance in the "System Components" list and click on the hyperlink
assosciated with it's name.

On the OC4J instance page, click on the "Administration" tab and on
the resulting page under the "Instance Properties" section, click on
the "Server Properties" link.

On the next page:

- scroll down to the "Command Line Options" section
- enter the full path to the "java" binary as the value provided
for the "Java Executable" field
- click on the "Apply" button

The validity of the provided path can be confirmed by running the same
path at a command prompt window with a "-version" flag. For example,
assuming "Java Executable" field value of /usr/j2sdk1.4.2_10/bin/java,
run:

% /usr/j2sdk1.4.2_10/bin/java -version

and confirm that this produces output similar to the following:

java version "1.4.2_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode

(d) Reload opmn using "opmnctl reload" so that it can pick up the
configuration changes.

Though Application Server Control will have automatically updated
the centralized copy of the opmn.xml file, it is still necessary togate
restart or reload opmn so that it re-reads it's updated configuration file:

% opmnctl reload
opmnctl: reconfiguring opmn...
opmnctl: opmn reloaded successfully...

(e) Start/Restart the desired OC4J instance with the new java executable
in place.

Finally, it will be necessary to stop any current running instance of the
desired OC4J instance so that opmn can be used to start a new instance
with the modified java executable.

You can navigate back to the top OC4J instance page under Application
Server Control and press the "Start" or "Restart" buttons.


2. Manually applying configuration file changes

Overview
--------
(a) Backup the current OPMN configuration file.
(b) Edit "opmn.xml" and set "java-bin" attribute within the opmn XML entries
for the desired OC4J instance to point to the desired "java" executable.
(c) Propagate the changes in this configuration file to the
configuration repository using "dcmctl updateConfig -ct opmn -v -d".
(d) Reload opmn using "opmnctl reload" so that it can pick up the
configuration changes.

Detailed Approach
-----------------
(a) Backup the current OPMN configuration file.

Make an additional copy of $ORACLE_HOME/opmn/conf/opmn.xml, so
that it can be referenced later or restored to it's original
condition:

% cd $ORACLE_HOME/opmn/conf
% cp opmn.xml opmn.xml.orig

(b) Edit "opmn.xml" file and locate the start of the XML entries
relating to the desired OC4J instance, for example:

<process-type id="myOc4J" module-id="OC4J">
<module-data>
<category id="start-parameters">

Check if the child elements for the "start-parameters" tag
contains a "java-bin" entry as shown below:

<category id="start-parameters">
<data id="java-options" value="-server -Djava.security.policy=
/as9/app/oracle/product/mid90420a/j2ee/myOc4j/config/java2.policy
-Djava.awt.headless=true"/>
<data id="oc4j-options" value="-properties"/>
<data id="java-bin" value="/path/to/java_home/bin/java"/>
</category>

If a java-bin entry does not exist, create one after the "oc4j-options"
entry as shown above.

Ensure that the "value" attribute is an absolute path to a "java" exutable
located in the "bin" sub-directory of a java installation. Confirm that
the value is appropriate by executing that path using the "-version"
argument.

For example, for a J2SDK installed at the location:

/usr/j2sdk1.4.2_10

The XML entries would look similar to the following:

<category id="start-parameters">
<data id="java-options" value="....."/>
<data id="oc4j-options" value="......"/>
<data id="java-bin" value="/usr/j2sdk1.4.2_10/bin/java"/>
</category>

Confirm the validity of value provided as the "java-bin" by executing
at the command prompt:

% /usr/j2sdk1.4.2_10/bin/java -version
java version "1.4.2_10"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_10-b03)
Java HotSpot(TM) Client VM (build 1.4.2_10-b03, mixed mode)

(c) For Application Server 9.0.4.x and 10.1.2.x versions only, propagate
the changes in this configuration file to the configuration repository
using "dcmctl updateConfig -ct opmn -v -d"

After making any manual change to a configuration file it is
necessary to run an appropriate "dcmctl updateConfig" command to
propagate the change to the configuration repository.

In this case where changes have only been made to "opmn.xml", these
can be propagated by running:

% dcmctl updateConfig -ct opmn -v -d

(d) Reload opmn using "opmnctl reload" so that it can pick up the
configuration changes

If the OPMN process is not running, the configuration changes will
take effect the next time opmn is started using:

% opmnctl start
opmnctl: opmn started

If opmn is already running, reload it using the following command,
which will force it to reload it's configuration file:

% opmnctl reload
opmnctl: reconfiguring opmn...
opmnctl: opmn reloaded successfully...

(e) Start/Restart the desired OC4J instance with the new java executable
in place.

Finally, it will be necessary to stop any current running instance of the
desired OC4J instance so that opmn can be used to start a new instance
with the modified java executable.

From the command line, use the following "opmnctl" commands which
illustrate how to stop/start an OC4J instance named "myOC4J":

% opmnctl stopproc process-type=myOC4J
% opmnctl startproc process-type=myOC4J

No comments:

Search This Blog