I have a Tomcat7
install on a CentOS (6.7)
system. Tomcat will not run, throwing exception in catalina.out
/usr/sbin/tomcat: line 29: -classpath: command not found
and related tomcat-initd.log
/usr/sbin/tomcat: error: Failed to set JAVACMD
According to this SF post, I should be able to set it in /usr/share/java-utils/java-functions
like this:
# Add all sorts of jvm layouts here
if [ -x "$JAVA_HOME/jre/sh/java" ]; then
JAVACMD="$JAVA_HOME/jre/sh/java"
elif [ -x "$JAVA_HOME/bin/java" ]; then
JAVACMD="$JAVA_HOME/bin/java"
else
JAVACMD=`which java 2>/dev/null`
fi
if [ ! -x "$JAVACMD" ]; then
echo "$0: error: Failed to set JAVACMD"
return 1
fi
But I still get the exception. What's missing? What am I not understanding, and how do I resolve the exception?
JAVA_HOME is set:
echo $JAVA_HOME
/usr/java/jdk1.7.0_79
Checking tomcat status:
sudo service tomcat status
PID file exists, but process is not running [WARNING]
tomcat lockfile exists but process is not running [FAILED]
This is true even after deleting the Tomcat pid file, rinsing and repeating.
Request responses:
whereis java
java: /usr/bin/java /etc/java /usr/lib/java /usr/share/java
ls -lad /usr/bin/java
lrwxrwxrwx. 1 root root 21 Jul 21 2015 /usr/bin/java -> /usr/java/jre1.8.0_51
ls -lad /etc/alternatives/java
lrwxrwxrwx. 1 root root 20 Jul 21 2015 /etc/alternatives/java -> /usr/java/glassfish4
after commenting out JAVA_HOME
in tomcat.conf
/etc/rc.d/init.d/tomcat start
Starting tomcat: [ OK ]
sudo service tomcat status
tomcat (pid 13517) is running... [ OK ]
Replace JAVA_HOME in the /etc/tomcat/tomcat.conf with /usr/java/jre1.8.0_51