Bug 788704

Summary: rhq-agent startup: Have set_java_home() to find recent JDKs
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: Launch ScriptsAssignee: RHQ Project Maintainer <rhq-maint>
Status: NEW --- QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.3CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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 ()
          JAVA_HOME=/usr
          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}"
       fi
    fi


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)