Wednesday, May 9, 2012

How to Change JDK used by Weblogic Server

Share this Post
Hi all,

Sometime it is required to switch JDK used by weblogic server for example from Sun to JRockit (which gives better performance). Another use case could be to switch from 32 to 64 bit JDK as well as latest supported JDK. To verify supported JDK version check Oracle FMW support matrix

In this post we will switch JDK from Sun to JRockit and i assume we are on Linux environment find same configuration file name with .CMD extension if you are on windows.

Installing new JDK:

First step is to install your desired JDK. Follow these steps to install

1. Download JRockit JDK from OTN

2. FTP the file to server and unzip it by running following command

$ unzip

3. The file will be extracted with .bin extension, change the permission and make it executable.

$ chmod 755 jrockit-jdk1.6.0_29-R28.2.2-4.1.0-linux-x64.bin

4. Install JRockit to your desired location (in my example i have xserver running).

Follow the wizard to complete the installation. I installed JRockit on /u01/Oracle/jrockit-r28.2.2

$ ./jrockit-jdk1.6.0_29-R28.2.2-4.1.0-linux-x64.bin

Changing Weblogic Configuration to use new JDK

1. Shutdown all managed servers in Weblogic domain

2. Backup the following files
$MW_HOME/user_projects/domains/<domain  name>/bin/

$ cd  /u01/Oracle/Middleware/user_projects/domains/base_domain/bin
$ cp

$ cd /u01/Oracle/Middleware/wlserver_10.3/common/bin
$ cp

3. Edit setDomain.env file and find ${JAVA_HOME}
     Comment the JAVA_HOME entry

#export  JAVA_HOME

4. Add the following after this

# Added the following lines to change to JRockit JDK
export  JAVA_HOME

5. Search the following section in the file, specifically for "-Djrockit.optfile":

Note: This parameter usually gives warning of being obsolete
you will find

EXTRA_JAVA_PROPERTIES="-Dcommon.components.home=${COMMON_COMPONENTS_HOME}   -Djrf.version=11.1.1  

remove the "-Djrockit.optfile" property:

6. Save the file

7. Edit file, find the following section

if [ -z "${JAVA_HOME}" -o -z "${JAVA_VENDOR}" ]; then

8. Add the following line after above section
export JAVA_HOME

9. Start Admin Server and confirm your changes by running following command

$  ps -ef | grep Admin

if you see something similar then your are good to start other managed servers
oracle   13927 13771  5 15:30 ?        00:03:58 /u01/Oracle/jrockit-r282.2/bin/java -jrockit -Xms2048m -Xmx2048m -Dweblogic.Name=AdminServer

Hope it help,
Zeeshan Baig