Bug 788704 - rhq-agent startup: Have set_java_home() to find recent JDKs
rhq-agent startup: Have set_java_home() to find recent JDKs
Status: NEW
Product: RHQ Project
Classification: Other
Component: Launch Scripts (Show other bugs)
Unspecified Unspecified
medium Severity unspecified (vote)
: ---
: ---
Assigned To: RHQ Project Maintainer
Mike Foley
Depends On:
  Show dependency treegraph
Reported: 2012-02-08 15:38 EST by Elias Ross
Modified: 2012-02-13 11:59 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Elias Ross 2012-02-08 15:38:38 EST
Trying to figure out why tools.jar is not being found...This is important for the new JMX plugin.

The key is realizing /usr/bin/java is a symbolic link, on Linux and Mac OS.

Should be:

diff --git a/rhq-agent/bin/rhq-agent.sh b/rhq-agent/bin/rhq-agent.sh
index 19a0ae6..92e5ba5 100755
--- a/rhq-agent/bin/rhq-agent.sh
+++ b/rhq-agent/bin/rhq-agent.sh
@@ -39,6 +39,9 @@ set_java_home ()
    if [ "x$JAVA_HOME" = "x" ]; then
       _WHICH_JAVA=`which java 2>/dev/null`
+      if [ -L $_WHICH_JAVA ]; then
+         _WHICH_JAVA=`readlink $_WHICH_JAVA`
+      fi
       if [ "x$_WHICH_JAVA" != "x" ]; then
          _WHICH_JAVA_BIN_DIR=`dirname "$_WHICH_JAVA"`
          JAVA_HOME=`dirname "$_WHICH_JAVA_BIN_DIR"`
@@ -47,7 +50,7 @@ set_java_home ()
          debug_msg "Running on Mac OS X, setting JAVA_HOME to ${JAVA_HOME}"
       elif [ "x$_LINUX" != "x" ]; then
-         JAVA_HOME=/usr/lib/jvm/jre
+         JAVA_HOME=/usr/java/default
          debug_msg "Running on Linux, setting JAVA_HOME to ${JAVA_HOME}"

It seems that on Linux JAVA_HOME of /usr/lib/jvm/jre is not applicable.

If you list the files for jdk-1.6.0_30-fcs (as an example):

rpm --query --filesbypkg jdk

everything is under /usr/java/X now.

JAVA_HOME should be set to either /usr/java/jdk1.6.0_30 or /usr/java/latest by default there.

there are no files in /usr/lib anymore.

JAVA_HOME should be /System/Library/Frameworks/JavaVM.framework/Versions/Current/ on Mac OS, probably. You will need to play around with getting tools.jar found there...
Comment 1 Mike Foley 2012-02-13 11:59:28 EST
per triage 2/13/2012 (asantos, crouch, foley, loleary)

Note You need to log in before you can comment on or make changes to this bug.