https://bz.apache.org/bugzilla/show_bug.cgi?id=61441
Bug ID: 61441
Summary: daemon.sh's auto-detection fails on linux system's
where java is installed via an RPM
Product: Tomcat 8
Version: 8.5.x-trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Packaging
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ----
On RHEL/Centos/Fedora, when java is installed from the RPMs neither JAVA_HOME
nor JRE_HOME environment variables are set. Luckily, the Tomcat startup scripts
are able to auto-detect them but the daemon.sh script cannot properly do so.
The failure is in the JAVA_HOME auto-detection in the script here:
daemon.sh:96:
~~~
JAVA_BIN="`which java 2>/dev/null || type java 2>&1`"
test -x "$JAVA_BIN" && JAVA_HOME="`dirname $JAVA_BIN`"
test ".$JAVA_HOME" != . && JAVA_HOME=`cd "$JAVA_HOME/.." >/dev/null; pwd`
~~~
The problem is that when java is installed from the RPMs, `which java`
evaluates to '/usr/bin/java', which is a symlink maintained by alternatives.
The code snippet above will evaluate to JAVA_HOME and JRE_HOME being set to
'/usr'. Having JRE_HOME set to '/usr' doesn't seem to cause problems for
Tomcat, but the problem manifests itself when running the daemon.sh script:
~~~
# ./daemon.sh start
Cannot find any VM in Java Home /usr
~~~
jsvc is only used in daemon.sh, therefore this problem was not seen when
starting Tomcat using startup.sh or catalina.sh.
I think a good fallback for JAVA_HOME and JRE_HOME is '/usr/lib/jvm/java' and
'/usr/lib/jvm/jre' respectively.
To Reproduce:
1. Install tomcat
2. Install java from RPMs
3. cd $CATALINA_HOME
4. bin/daemon.sh start
5. Observe error mentioned above
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]