In APM 10.5.1, the EPAgent on Linux/Unix is installed and runs under a Java wrapper service EPAgent using the configuration file epagent/conf/EPAService.conf.
After setting JAVA_HOME as an exported environment variable when running the commands "./EPACtrl.sh install" or "./EPACtrl.sh start" from the epagent/bin directory, the agent fails to start & the bin/wrapper.log file contains these messages:
| WARN | The 'JAVA_HOME' environment variable was referenced but has not been defined.
| WARN | The configured wrapper.java.command could not be found, attempting to launch anyway: %JAVA_HOME%/bin/java
...
| ERROR | JVM exited while loading the application.
| ERROR | Unable to start JVM: No such file or directory (2)
The installed service EPAgent is running as a daemon by the init process. So it does not inherit the current JAVA_HOME environment variable and is just a symbolic link to the epagent/bin/EPACtrl.sh file i.e.
# ls -al /etc/init.d/EPAgent
lrwxrwxrwx. 1 root root 43 Feb 7 09:58 /etc/init.d/EPAgent -> /root/epagent/bin/./EPACtrl.sh
To resolve the problem,
EITHER:
Edit the file conf/EPAService.conf and after the commented line "#set.JAVA_HOME=C:\Program Files\jdk1.7.0" add this new line:
set.JAVA_HOME=<FULL PATH OF jre directory>
OR:
Edit the file bin/EPACtrl.sh. In the existing 'if' block for the OSX check, add an extra 'else' block as follows:
# OSX always places Java in the same location so we can reliably set JAVA_HOME
if [ "$DIST_OS" = "macosx" ]
then
if [ -z "$JAVA_HOME" ]; then
JAVA_HOME="/Library/Java/Home"; export JAVA_HOME
fi
else
JAVA_HOME=<FULL PATH OF jre directory>; export JAVA_HOME
fi
APM 10.5.1. APM Command Center service apmccctrl will encounter a similar problem and requires the same resolution in its configuration file CommandCenterServer/config/apmccsrv.properties orscript CommandCenterServer/apmccsrv.sh