Wednesday, 17 October 2012

Upgrade the JDK used by an Oracle WebLogic Server installation to a newer version

Hi Everyone,

Today I have migrated the  JDK used by an Oracle WebLogic Server. My previous version was jdk1.6.0_24 and currently I have upgraded it to jdk1.6.0_31.This article  illustrate the steps to upgrade the JDK used by an Oracle WebLogic Server installation to a newer version. Normally the steps would apply to move from the default JDK used during the installation to a higher version, even that they could be applied the same way to achieve a downgrade.

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 only to one domain, or to nodemanager), but the difficulty around it is to know which files do refer to a JDK location.

The initial list of files to change will be :
* $MW_HOME/wlserver_10.3/common/bin/commEnv.sh
* $MW_HOME/user_projects/domains/<mydomain>/bin/setDomainEnv.sh
* $MW_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties
* $MW_HOME/utils/bsu/bsu.sh
* $MW_HOME/utils/quickstart/quickstart.sh
* $MW_HOME/utils/uninstall/uninstall.sh

Note: Before changing any file please take a backup.
even that a more exhaustive way to determine them, will be to run command
find . -exec grep -il JAVA_HOME {} \; | grep .sh


1) Locate the involved JDK versions.
For the examples the following are used:
Old_JDK: /oracle/wls1033/ jdk1.6.0_24
New_JDK: /jdks/jdk1.6.0_31

2) Stop all processes that use the current MW_HOME. This refers to 
 - all the AdminServer and managed_servers in all domains,
- all the nodemanager processes running in this MW_HOME, and
- potentially processes running Bea SmartUpgrade at that specific moment.

3) Edit $MW_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/ 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

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="/jdks/jdk1.6.0_31"
# 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 accomodate for the net JAVA_HOME .
 For default location and default scripts, the setDomainEnv.sh will be placed here:
$MW_HOME/user_projects/domains/<domainName>/bin/setDomainEnv.sh
Check carefully where and how the JAVA_HOME environment variable is changed as this might change accross 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/ jdk1.6.0_24"
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/ jdk1.6.0_24"
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="/jdks/jdk1.6.0_31"
export SUN_JAVA_HOME

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

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

From:
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

To:

PropertiesVersion=10.3
javaHome=/jdks/jdk1.6.0_31
AuthenticationEnabled=true
NodeManagerHome=/oracle/wls1033/wlserver_10.3/common/nodemanager
JavaHome=/jdks/jdk1.6.0_31/jre
LogLevel=INFO

7) Replace the new JDK location on all the minor tools used in the same MW_HOME, such as BSU, uninstaller, etc.

For the Bea SmartUpgrade tool $MW_HOME/utils/bsu/bsu.sh

Update this line:
JAVA_HOME="/opt/ jdk1.6.0_24"
to
JAVA_HOME="/jdks/jdk1.6.0_31"

Similarly, change JAVA_HOME values for the remaining three files
* $MW_HOME/utils/quickstart/quickstart.sh
* $MW_HOME/utils/uninstall/uninstall.sh

8) Restart the processes as normal, they should take the new JDK version.

“Effort only fully releases its reward after a person refuses to quit.”

Regards,
Akhilesh B. Humbe
 

No comments:

Post a Comment

Popular Posts