Hi All,
I want to discuss a case when RH-based VM is provisioned and the image
comes with pre-installed java 6 or 7, but the BP requires latest java
(java 8 as of now).
This particular case is rare for now, because Brooklyn specifies java 7
by default, but it will became common when java 8 is set as the version
expected by Brooklyn.
RH-based distros usually use the openjdk SRPMs provided by RedHat and
then just recompile them. All SRPMs have a SPEC file used during its
rebuild. It specifies how the particular java version will be installed
and what will be the *priority* in case of multiple versions. The
*priority* itself is passed as a configuration parameter to the
*alternatives* executable [1].
OpenJDK 6 and 7 packages use priority similar to *1700%{updatever}*, but
OpenJDK 8 - 18%{updatever}.
When VM is provisioned and the image contains JDK 6 or 7 the already
installed java version has much higher priority than the expected one
for JDK8. For example:
JDK 6 will have a priority number as 160075, and then JDK 8 will have
1875 - *1600075 > 1875*
The provisioned VM will have 2 versions of java, but the one with the
higher priority will be used. It will be a problem with the deployed
software if it requires Java 8.
It seems that it is a intended behavior described in RedHat's bug
tracking system [2]
We have the following options to address the issue:
1. Leave it as it is and update the docs so the users are aware, if they
use images with per-installed Java packages
2. Provide a post-install configuration (using the *alternatives* tool)
to ensure that the intended java version is set as a default option
3. Ensure that all previously installed java versions are removed (yum
remove) , before installing Java 8
Maybe option 2) is preferable, but not entirely sure for the BYON or
SameServer scenarios where we can find a java version that is used by an
already installed applications.
What do you think will be the best approach to fix and/or workaround it?
Regards,
Yavor
[1]
https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Configure_the_Default_JDK_on_Red_Hat_Enterprise_Linux.html
[2] https://bugzilla.redhat.com/show_bug.cgi?id=1175457#c33