By William Sescu

In this blog, I would like to show how to change the Java version used by OUD and WebLogic, in case you use the ODSM. The OUD (Oracle Unified Directory) is written purely in Java, not like OID for example, and so, it relies heavily on your installed Java version. From a security point of view, updating the Java version is a task that you might do frequently and you want to do it as easy as possible. E.g. by just changing a symbolic link. In my case, I would like to update the Java version from 1.7.0_131 to 1.7.0_141. The first time you do the change, you have a few steps of manual steps to do, but the next Java updates will be much easier, by just changing a symbolic link.

So … the first question that might popp up is, where can I get Java 7 downloads? You can find them
in the Java SE 7 Archive Downloads, however, the Java 1.7 is freely available only until version 1.7.0_80, and for OUD you have to use Java 1.7 because this is the only supported version. Here is the link to the Java 1.7 archive downloads.

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html

Hint: In case you use SSLv3, the following announcement might be of interest for you. Starting with the January 20, 2015 Critical Patch Update releases JDK 7u75 and above, the Java Runtime Environment has SSLv3 disabled by default. For more information check out the following web page.

http://www.oracle.com/technetwork/java/javase/documentation/cve-2014-3566-2342133.html

OK. So, where do I get the latest Java version which is 1.7.0_141 at the moment? Since July 2015, the updates for Java 7 are no longer available to the public. Oracle offers updates to Java 7 only for customers who have purchased Java support or have Oracle products that require Java 7. That means, you have to go to MOS and search for the following note:

Information Center: Installation & Configuration for Oracle Java SE (Doc ID 1412103.2)

There you will find a link which points you to the JDK/JRE 7 Update 141 and “Patch 13079846: Oracle JDK 1.7.0”.

Java download

OK. Now that we go the latest 1.7 version, we can start with the upgrade procedure which consists of 8 steps.

1. Check the current version
2. Install the new Java version
3. Stop WebLogic and the OUD
4. Adjust the symlink
5. Update OUD configuration files (java.properties)
6. Update WebLogic configuration files
7. Start WebLogic and the OUD
8. Check the new version

1. Check the current version of your Java installation, WebLogic Server and OUD.

The Java version can be checked via “java -version”

[dbafmw@dbidg01 ~]$ echo $JAVA_HOME
/u01/app/oracle/product/Middleware/11.1.2.3/jdk1.7.0_131	
[dbafmw@dbidg01 bin]$ /u01/app/oracle/product/Middleware/11.1.2.3/jdk1.7.0_131/bin/java -version
java version "1.7.0_131"
Java(TM) SE Runtime Environment (build 1.7.0_131-b12)
Java HotSpot(TM) 64-Bit Server VM (build 24.131-b12, mixed mode)

To check the Java vendor and Java version used by WebLogic Server, I use usually the Admin Console. Just go to Environment > Servers > Your Server > Monitoring > General

That page should have all the information that you need, like on the following screen shot:

WebLogic 131
To check the Java version used by OUD, simply login to the ODSM and on the Home page you will see it immediately.

OUD version 131

Or use the status script from the command line.

[dbafmw@dbidg01 bin]$ /u01/app/oracle/product/Middleware/11.1.2.3/asinst_1/OUD/bin/status -D "cn=Directory Manager" -j ~/.oudpwd  | grep "Java Version"
Java Version:             1.7.0_131

2. Install the new Java version

[dbafmw@dbidg01 ~]$ cd /u01/stage/
[dbafmw@dbidg01 stage]$ unzip p13079846_17000_Linux-x86-64.zip
...
...
[dbafmw@dbidg01 stage]$ mv jdk-7u141-linux-x64.tar.gz /u01/app/oracle/product/Middleware/11.1.2.3/

[dbafmw@dbidg01 stage]$ cd /u01/app/oracle/product/Middleware/11.1.2.3/
[dbafmw@dbidg01 11.1.2.3]$ tar -xzvf jdk-7u141-linux-x64.tar.gz
...
...
[dbafmw@dbidg01 11.1.2.3]$ rm jdk-7u141-linux-x64.tar.gz

[dbafmw@dbidg01 11.1.2.3]$ ls -l | grep jdk
lrwxrwxrwx  1 dbafmw oinstall     12 Mar 27 10:36 jdk -> jdk1.7.0_131
drwxr-x---  8 dbafmw oinstall   4096 Dec 12 23:34 jdk1.7.0_131
drwxr-xr-x  8 dbafmw oinstall   4096 Mar 14 06:10 jdk1.7.0_141

3. Stop WebLogic and the OUD

Stop WebLogic

[dbafmw@dbidg01 bin]$ . /u01/app/oracle/product/Middleware/11.1.2.3/wlserver_10.3/server/bin/setWLSEnv.sh
[dbafmw@dbidg01 bin]$ java weblogic.version -verbose
[dbafmw@dbidg01 bin]$ cd /u01/app/oracle/product/Middleware/11.1.2.3/user_projects/domains/base_domain/bin
[dbafmw@dbidg01 bin]$ ./stopWebLogic.sh
...
...

Stop OUD

[dbafmw@dbidg01 bin]$ /u01/app/oracle/product/Middleware/11.1.2.3/asinst_1/OUD/bin/stop-ds
...
...

4. Adjust the symlink

[dbafmw@dbidg01 11.1.2.3]$ rm jdk
[dbafmw@dbidg01 11.1.2.3]$ ln -s jdk1.7.0_141 jdk
[dbafmw@dbidg01 11.1.2.3]$ ls -l | grep jdk
lrwxrwxrwx  1 dbafmw oinstall     12 May 29 14:10 jdk -> jdk1.7.0_141
drwxr-x---  8 dbafmw oinstall   4096 Dec 12 23:34 jdk1.7.0_131
drwxr-xr-x  8 dbafmw oinstall   4096 Mar 14 06:10 jdk1.7.0_141

5. Update OUD configuration files (java.properties)

The update of the OUD java.properties file is usually done in the INSTALL_HOME and the INSTANCE_HOME, and the activated via the dsjavaproperties script from the appropriate location. The dsjavaproperties script is quite good documented by Oracle. See the following link for more information.

http://docs.oracle.com/cd/E52734_01/oud/OUDAG/appendix_cli.htm#OUDAG01148

Ok. Let’s do it once for your INSTALL_HOME

[dbafmw@dbidg01 11.1.2.3]$ vi $MW_HOME/Oracle_OUD1/config/java.properties
... 
default.java-home=/u01/app/oracle/product/Middleware/11.1.2.3/jdk/jre

Now you can apply the new java configuration with dsjavaproperties shell script.

[dbafmw@dbidg01 11.1.2.3]$ cd $MW_HOME/
[dbafmw@dbidg01 11.1.2.3]$ cd Oracle_OUD1/bin
[dbafmw@dbidg01 bin]$ ./dsjavaproperties
The operation was successful.  The server commands will use the java arguments
and java home specified in the properties file located in
/u01/app/oracle/product/Middleware/11.1.2.3/asinst_1/OUD/config/java.properties

And now for your INSTANCE_HOME

[dbafmw@dbidg01 11.1.2.3]$ vi $MW_HOME/asinst_1/OUD/config/java.properties
...
default.java-home=/u01/app/oracle/product/Middleware/11.1.2.3/jdk/jre

And apply the new java configuration with dsjavaproperties shell script here as well.

[dbafmw@dbidg01 11.1.2.3]$ cd $MW_HOME/
[dbafmw@dbidg01 11.1.2.3]$ cd asinst_1/OUD/bin/
[dbafmw@dbidg01 bin]$ ./dsjavaproperties
The operation was successful.  The server commands will use the java arguments
and java home specified in the properties file located in
/u01/app/oracle/product/Middleware/11.1.2.3/asinst_1/OUD/config/java.properties

6. Update Weblogic configuration files

Adjust the JAVA_HOME in the following files and point it now to the symlink which we have previously created. So, the new Java home should be:

JAVA_HOME=/u01/app/oracle/product/Middleware/11.1.2.3/jdk

These are the files where you typically need to adjust it:

~/.bash_profile  # of the Application owner of the WebLogic/OUD installation
$MW_HOME/wlserver_10.3/common/bin/commEnv.sh
$MW_HOME/wlserver_10.3/samples/domains/wl_server/bin/setDomainEnv.sh
$MW_HOME/wlserver_10.3/samples/domains/medrec/bin/setDomainEnv.sh
$MW_HOME/wlserver_10.3/samples/domains/medrec-spring/bin/setDomainEnv.sh
$MW_HOME/wlserver_10.3/common/nodemanager/nodemanager.properties
$MW_HOME/utils/bsu/bsu.sh 
$MW_HOME/utils/uninstall/uninstall.sh
$MW_HOME/utils/quickstart/quickstart.sh
$MW_HOME/user_projects/domains/base_domain/bin/setDomainEnv.sh

To double check it, you might want to run the following find command, to see if you have somewhere else still the old 131 JDK.

[dbafmw@dbidg01 11.1.2.3]$ cd $MW_HOME
[dbafmw@dbidg01 11.1.2.3]$ find . -type f -name "*.sh" -exec grep -il jdk1.7.0_131 {} \;

7. Start WebLogic and the OUD

Start WebLogic

[dbafmw@dbidg01 bin]$ . /u01/app/oracle/product/Middleware/11.1.2.3/wlserver_10.3/server/bin/setWLSEnv.sh
[dbafmw@dbidg01 bin]$ java weblogic.version -verbose
[dbafmw@dbidg01 bin]$ cd /u01/app/oracle/product/Middleware/11.1.2.3/user_projects/domains/base_domain/bin
[dbafmw@dbidg01 bin]$ nohup ./startWebLogic.sh &
...
...

Start OUD

[dbafmw@dbidg01 bin]$ /u01/app/oracle/product/Middleware/11.1.2.3/asinst_1/OUD/bin/start-ds
...
...

8. Check the new version

[dbafmw@dbidg01 bin]$ echo $JAVA_HOME
/u01/app/oracle/product/Middleware/11.1.2.3/jdk
[dbafmw@dbidg01 bin]$ /u01/app/oracle/product/Middleware/11.1.2.3/jdk/bin/java -version
java version "1.7.0_141"
Java(TM) SE Runtime Environment (build 1.7.0_141-b11)
Java HotSpot(TM) 64-Bit Server VM (build 24.141-b11, mixed mode)

To check the Java vendor and Java version used by WebLogic Server, use again the  WebLogic Admin Console like previously mentioned.

WebLogic 141

And login to the ODSM.

OUD version 141
Or use the status script from the command line.

[dbafmw@dbidg01 bin]$ /u01/app/oracle/product/Middleware/11.1.2.3/asinst_1/OUD/bin/status -D "cn=Directory Manager" -j ~/.oudpwd  | grep "Java Version"
Java Version:             1.7.0_141

Conclusion

A few manual steps are involved, when you want to change the Java version the first time, however, the next time you do it, you simply need to stop WebLogic and OUD, install the new JDK and change the symbolic link and start WebLogic and OUD again.