modules/enterprise/agent/src/etc/rhq-agent.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
New commits: commit e437f5771c4b79ce570ad24cb3c545078d9a944a Author: Lukas Krejci lkrejci@redhat.com Date: Thu Dec 20 00:18:51 2012 +0100
[BZ 880795] - The upgraded Augeas library no longer contains the file "libaugeas.so", which causes the default native library lookup mechanisms to fail. Standard ld should be able to find the .so.x.y files, too, but the presence of java.library.path system property seems to be causing this not to kick in during the library loading as done by the JVM.
To work around this problem, we need to instruct JNA to have a "backup plan" in case the standard lookup mechanisms fail. This can be done using the "jna.platform.library.path" system property, which instructs JNA to use that path to look up libraries if everything else fails (and do the .so.x.y resolution on its own).
We set this variable to the same value as we override LD_LIBRARY_PATH to so that JNA library loading and native (as in system-wide) library loading works the same for the agent process. This way we can load the JNA libraries using the .so.x.y resolution the same way as the system resolves the native libraries using stadard ld mechanisms in spite of there being the java.library.path variable set (which is needed by SIGAR).
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh b/modules/enterprise/agent/src/etc/rhq-agent.sh index e80581d..b3ee8a7 100755 --- a/modules/enterprise/agent/src/etc/rhq-agent.sh +++ b/modules/enterprise/agent/src/etc/rhq-agent.sh @@ -212,7 +212,9 @@ fi debug_msg "RHQ_AGENT_CMDLINE_OPTS: $RHQ_AGENT_CMDLINE_OPTS"
# ---------------------------------------------------------------------- -# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent +# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent and +# prepare jna.platform.library.path for JNA to be able to load augeas from our +# custom location. # ----------------------------------------------------------------------
if [ -n "$_LINUX" ]; then @@ -230,6 +232,13 @@ if [ -n "$_LINUX" ]; then fi fi export LD_LIBRARY_PATH + + # We need to force our custom library path as the "system" look up path to + # JNA. Without this, the lookup of .so.x.y versions wouldn't work. + # We also need to keep the LD_LIBRARY_PATH in place so that the default + # system lookup works for libfa, which libaugeas depends on. + _JNA_LIBRARY_PATH=""-Djna.platform.library.path=${LD_LIBRARY_PATH}"" + debug_msg "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" fi
@@ -265,7 +274,7 @@ if [ -z "$RHQ_AGENT_MAINCLASS" ]; then fi
# Build the command line that starts the VM -CMD=""${RHQ_AGENT_JAVA_EXE_FILE_PATH}" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp "${CLASSPATH}" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}" +CMD=""${RHQ_AGENT_JAVA_EXE_FILE_PATH}" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp "${CLASSPATH}" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
debug_msg "Executing the agent with this command line:" debug_msg "$CMD"
rhq-commits@lists.fedorahosted.org