How to Upgrade the JDK Used by Oracle WebLogic Server UNIX installations to a Different Version


There are two different approaches that can be used to achieve the required goal. Both will be described briefly:
A) Installing a new JDK home, and using symbolic link to "rename" the existing and new JDK directories.
Following this approach, the JDK location originally used during the installation will not change and hence it has the minimal drawback that it might keep a versioned name as for example "$INSTALL_HOME/jdk_".
In any of the cases, this approach is simpler and less error prone than Approach B)

B) Installing a new JDK home directory and replacing the JAVA_HOME environmental variable in *** all *** the scripts referring to it.

This is the preferred approach if you want to do a partial upgrade (affecting to specific domains only, or not affecting to nodemanager), but its difficulty is around on how to know which files do refer to a JDK location.

The initial list of files to change will be :
* $INSTALL_HOME/wlserver_10.3/common/bin/commEnv.sh
* $INSTALL_HOME/user_projects/domains/<mydomain>/bin/setDomainEnv.sh
* $INSTALL_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties
* $INSTALL_HOME/utils/bsu/bsu.sh
* $INSTALL_HOME/utils/quickstart/quickstart.sh
* $INSTALL_HOME/utils/uninstall/uninstall.sh
even that a more exhaustive way to determine them, will be to run the following command:
find . -type f -name "*.sh" -exec grep -il JAVA_HOME {} \;

Step by Step Actions

Approach A)

1) Assume the source and target locations are the following:
sourceJDK: /oracle/wls1033/jdk160_18
targetJDK: /oracle/wls1033/jdk1.6.0_24
2) Stop all processes that use the current FMW_HOME. This refers to

- all the AdminServer and managed_servers in all domains,
- all the nodemanager processes running in this FMW_HOME, and
- potentially processes running Bea SmartUpgrade at that specific moment.

3) Rename directories:

a) Go to the parent directory of the source JDK:
% cd $INSTALL_HOME/
b) You can determine whether the location is a symbolic link or not by executing the command "ls -ld jdk<version>":
% ls -ld jdk160_18

If the listed information shows jdk160_18 with attributes lrwxrwxrwx (notice the first 'l') this is a link.
If the listed information shows jdk160_18 with attributes drwxrwxrwx (notice the first 'd') this is a directory.
c) Move the existing JDK location to a "backup name", as for example:
% mv jdk160_18 jdk160_18.orig
This will rename jdk160_18 to jdk160_18.orig in either case, being it a directory or a link.

d) And create a symbolic link like this:
% ln -s /oracle/wls1033/jdk1.6.0_24 jdk160_18
e) Validate that this step has been completed successfully by running the following command:
% $INSTALL_HOME/jdk160_18/bin/java -fullversion
If this does not return the expected version string of the installed JSDK, please check the
validity of the symbolic link or seek additional assistance from your UNIX system administrator.
4) Only in the case that you are using WLS 10.3.6 and the targetJDK is using a certified version of JAVA 7 (version 1.7.0_x) , you will need to copy manually some jar files as follows:
Copy the following files from $INSTALL_HOME/modules to  the directory  targetJDK/jre/lib/endorsed
javax.annotation_1.0.0.0_1-0.jar
javax.xml.bind_2.1.1.jar
javax.xml.ws_2.1.1.jar
5) Restart the processes as normal, they should take the new JDK version.
NOTE: Even if there is not a requirement of how to name the JDK directory that Weblogic Server will be using, and in many cases it is desirable to have the version in the directory name, it might happen as in the examples, that the symbolic link in truth points to a later version (from the examples, the symbolic link jdk160_18  in truth points to the 1.6.0_24)
Hence, an extra bit of planning DURING THE INITIAL INSTALLATION TIME would avoid that problem.
If the directory is renamed to something generic like "java" or "jdk" before installing WebLogic Server, then the upgrade of jdk described in "Approach A" will not cause that effect.
In the case that the original jdk directory name is desired to be changed, then the only option would be to follow Approach B) and change all the scripted files.

NOTE 2:
The reconfiguration required for Windows environments is theoricaly valid following the Approach A) by just renaming the existing source %INSTALL_HOME%/jdk location to %INSTALL_HOME%/jdk.old and making sure that the new JDK version is placed in %INSTALL_HOME%/jdk
However at the moment of writing the "NOTE 2" section, this has not been tested explicitly.

Approach B)
1) Locate the involved JDK versions.
a) sourceJDK: Let's assume the JDK used is $INSTALL_HOME/jdk<version>

For installations done with WLS platform installers (32 bit Windows, Linux, Solaris) the JDK used will be $INSTALL_HOME/jdk .
For installations done with WLS generic installer (64 bit and all other platforms) the JDK location can be any other place in the filesystem.

b) targetJDK: Lets assume the new JDK is located at /opt/newjdk
For the examples above the following are used:
sourceJDK: /oracle/wls1033/jdk160_18
targetJDK: /oracle/wls1033/jdk1.6.0_24

2) Stop all processes that use the current FMW_HOME. This refers to

- all the AdminServer and managed_servers in all domains,
- all the nodemanager processes running in this FMW_HOME, and
- potentially processes running Bea SmartUpgrade at that specific moment.

3) Edit $INSTALL_HOME/wlserver_10.3/common/bin/commEnv.sh and change the JAVA_HOME location. For example, change from:
# Reset JAVA_HOME, JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
# and JAVA_VENDOR are pre-defined.
if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
# Set up JAVA HOME
JAVA_HOME="/oracle/wls1033/jdk160_18"
# Set up JAVA VENDOR, possible values are
#Oracle, HP, IBM, Sun ...
JAVA_VENDOR=Sun
# PRODUCTION_MODE, default to the development mode
PRODUCTION_MODE=""
fi
To:
# Reset JAVA_HOME, JAVA_VENDOR and PRODUCTION_MODE unless JAVA_HOME
# and JAVA_VENDOR are pre-defined.
if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then
# Set up JAVA HOME
JAVA_HOME="/oracle/wls1033/jdk1.6.0_24"
# Set up JAVA VENDOR, possible values are
#Oracle, HP, IBM, Sun ...
JAVA_VENDOR=Sun
# PRODUCTION_MODE, default to the development mode
PRODUCTION_MODE=""
fi

4) For every domain, change the domain "setDomainEnv.sh" script to accommodate for the net JAVA_HOME .

For default location and default scripts, the setDomainEnv.sh will be placed here:
$INSTALL_HOME/user_projects/domains/<domainName>/bin/setDomainEnv.sh
Check carefully where and how the JAVA_HOME environment variable is changed as this might change accros versions.

For example in WLS 10.3.3 this will be as follows:
BEA_JAVA_HOME="/oracle/wls1033/jrockit_160_17_R28.0.0-679"
export BEA_JAVA_HOME

SUN_JAVA_HOME="/oracle/wls1033/jdk160_18"
export SUN_JAVA_HOME

if [ "${JAVA_VENDOR}" = "Oracle" ] ; then
JAVA_HOME="${BEA_JAVA_HOME}"
export JAVA_HOME
else
if [ "${JAVA_VENDOR}" = "Sun" ] ; then
JAVA_HOME="${SUN_JAVA_HOME}"
export JAVA_HOME
else
JAVA_VENDOR="Sun"
export JAVA_VENDOR
JAVA_HOME="/oracle/wls1033/jdk160_18"
export JAVA_HOME
fi
fi
And hence, the change will have to be done for SUN_JAVA_HOME, to specify the new location:
SUN_JAVA_HOME="/oracle/wls1033/jdk1.6.0_24"
export SUN_JAVA_HOME

5) Change the JDK location specified in nodemanager.properties for the default and any other existing nodemanager process:

a) Take a backup of $INSTALL_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties

From:
PropertiesVersion=10.3
javaHome=/oracle/wls1033/jdk160_18
AuthenticationEnabled=true
NodeManagerHome=/oracle/wls1033/wlserver_10.3/common/nodemanager
JavaHome=/oracle/wls1033/jdk160_18/jre
LogLevel=INFO
To:
PropertiesVersion=10.3
javaHome=/oracle/wls1033/jdk1.6.0_24
AuthenticationEnabled=true
NodeManagerHome=/oracle/wls1033/wlserver_10.3/common/nodemanager
JavaHome=/oracle/wls1033/jdk1.6.0_24/jre
LogLevel=INFO

6) Replace the new JDK location on all the minor tools used in the same FMW_HOME, such as BSU, uninstall.sh, etc.

For the Bea SmartUpgrade tool $INSTALL_HOME/utils/bsu/bsu.sh
Update this line:
from
JAVA_HOME="/opt/JDK1.6.14"
to
JAVA_HOME="/oracle/wls1033/jdk1.6.0_24"
Similarly, change JAVA_HOME values for the remaining three files
* $INSTALL_HOME/utils/quickstart/quickstart.sh
* $INSTALL_HOME/utils/uninstall/uninstall.sh

7) Only in the case that you are using WLS 10.3.6 and the targetJDK is using a certified version of JAVA 7 (version 1.7.0_x) , you will need to copy manually some jar files as follows:
Copy the following files from $INSTALL_HOME/modules to  the directory  targetJDK/jre/lib/endorsed
javax.annotation_1.0.0.0_1-0.jar
javax.xml.bind_2.1.1.jar
javax.xml.ws_2.1.1.jar

8) Restart all the required processes.