How to upgrade openjdk on RHEV?
Environment
Red Hat Enterprise Virtualization (RHEV) 3.2
Issue
During applicaiton of errata on the RHEV-M server the Java VM (jvm) was upgraded to a newer release. We were unable to start ovirt-engine due to mismatch and had to downgrade to the earlier version.
How can we update the OpenJDK on RHEV-M?
Resolution
Make sure that the JAVA_HOME setting in /etc/sysconfig/ovirt-engine points to to the [default] "generic" value:
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
If you override this value, updates of the OpenJDK can prevent normal startup of the RHEV manager.
Root Cause
Having a custom JAVA_HOME in RHEV-M's configuration file can cause problems:
$ grep HOME etc/sysconfig/ovirt-engine
#JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.25.x86_64
The default JAVA_HOME points to a symlink that is automatically maintained and updated by the OpenJDK packages.
Diagnostic Steps
Verification that the default setting works on a test environment:
- JAVA_HOME is pointing to the "generic openjdk-1.7.0 jvm" link:
# grep HOME /etc/sysconfig/ovirt-engine
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
- OpenJDK 1.7 was slightly out of date:
# ls -ld /usr/lib/jvm/jre-1.7.0-openjdk.x86_64
lrwxrwxrwx. 1 root root 38 20 des 12:05 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.45.x86_64/jre
# rpm -qf /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.45.x86_64/jre
java-1.7.0-openjdk-1.7.0.45-2.4.3.4.el6_5.x86_64
- Update it:
# yum update java-1.7.0-openjdk
[...]
This system is receiving updates from RHN Classic or RHN Satellite.
Setting up Update Process
Resolving Dependencies
[...]
Running Transaction
Updating : 1:java-1.7.0-openjdk-1.7.0.51-2.4.4.1.el6_5.x86_64 1/4
Updating : 1:java-1.7.0-openjdk-devel-1.7.0.51-2.4.4.1.el6_5.x86_64 2/4
Cleanup : 1:java-1.7.0-openjdk-1.7.0.45-2.4.3.4.el6_5.x86_64 3/4
Cleanup : 1:java-1.7.0-openjdk-devel-1.7.0.45-2.4.3.4.el6_5.x86_64 4/4
[...]
Complete!
- Now the link points to the new version:
# ls -ld /usr/lib/jvm/jre-1.7.0-openjdk.x86_64
lrwxrwxrwx. 1 root root 38 4 feb 15:40 /usr/lib/jvm/jre-1.7.0-openjdk.x86_64 -> java-1.7.0-openjdk-1.7.0.51.x86_64/jre
- and restarting the service works just fine:
# service ovirt-engine restart
Stopping engine-service: [ OK ]
Starting engine-service: [ OK ]
# lsof -n -p `pidof engine-service` | grep bin/java
java 3049 ovirt txt REG 253,0 5152 3419338 /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.51.x86_64/jre/bin/java
So: fixing the JAVA_HOME setting in /etc/sysconfig/ovirt-engine should avoid this problem.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
