After running an update via yum
on my CentOS 6.7
server, my Tomcat7
instance has stopped functioning properly.
message during update:
warning: /etc/tomcat/server.xml created as /etc/tomcat/server.xml.rpmnew
There are two logs that have exceptions in them after running:
/etc/rc.d/init.d/tomcat restart
Stopping tomcat: [FAILED]
Starting tomcat: [FAILED]
catalina.out:
/usr/sbin/tomcat: line 59: -classpath: command not found
tomcat-initd.log:
/usr/sbin/tomcat: error: Failed to set JAVACMD
However, if I update tomcat.conf to the following:
# Where your tomcat installation lives
CATALINA_BASE="/usr/share/java/tomcat"
CATALINA_HOME="/usr/share/java/tomcat"
JASPER_HOME="/usr/share/java/tomcat"
CATALINA_TMPDIR="/var/cache/tomcat/temp"
which has in it:
ls -all /usr/share/java/tomcat
total 19180
drwxrwxrwx. 2 tomcat root 4096 Feb 18 21:50 .
drwxr-xr-x. 10 root root 12288 Feb 18 21:50 ..
-rw-r--r--. 1 root root 16910 Jan 6 13:50 annotations-api.jar
-rwxr-xr-x. 1 root root 1997327 Jul 23 2014 bcprov-jdk15on-147.jar
-rw-r--r--. 1 root root 55617 Jan 6 13:50 catalina-ant.jar
-rw-r--r--. 1 root root 132331 Jan 6 13:50 catalina-ha.jar
-rw-r--r--. 1 root root 1638948 Jan 6 13:50 catalina.jar
-rw-r--r--. 1 root root 261524 Jan 6 13:50 catalina-tribes.jar
lrwxrwxrwx. 1 root root 47 Feb 18 21:50 commons-collections.jar -> /usr/share/java/jakarta-commons-collections.jar
-rwxr-xr-x. 1 root root 354491 Jul 23 2014 commons-configuration-1.8.jar
-rwxr-xr-x. 1 root root 2309495 Jul 23 2014 commons-configuration-1.8-javadoc.jar
lrwxrwxrwx. 1 root root 40 Feb 18 21:50 commons-dbcp.jar -> /usr/share/java/jakarta-commons-dbcp.jar
-rwxr-xr-x. 1 root root 241614 Jul 23 2014 commons-digester3-3.2.jar
-rwxr-xr-x. 1 root root 852037 Jul 23 2014 commons-digester3-3.2-javadoc.jar
-rwxr-xr-x. 1 root root 282032 Jul 23 2014 commons-digester3-3.2-sources.jar
-rwxr-xr-x. 1 root root 734212 Jul 23 2014 commons-digester3-3.2-with-deps.jar
-rwxr-xr-x. 1 root root 284220 Jul 23 2014 commons-lang-2.6.jar
-rwxr-xr-x. 1 root root 1624033 Jul 23 2014 commons-lang-2.6-javadoc.jar
-rwxr-xr-x. 1 root root 372982 Jul 23 2014 commons-lang-2.6-sources.jar
-rwxr-xr-x. 1 root root 60841 Jul 23 2014 commons-logging-1.1.1.jar
-rwxr-xr-x. 1 root root 141401 Jul 23 2014 commons-logging-1.1.1-javadoc.jar
-rwxr-xr-x. 1 root root 74976 Jul 23 2014 commons-logging-1.1.1-sources.jar
-rwxr-xr-x. 1 root root 26520 Jul 23 2014 commons-logging-adapters-1.1.1.jar
-rwxr-xr-x. 1 root root 52313 Jul 23 2014 commons-logging-api-1.1.1.jar
-rwxr-xr-x. 1 root root 1749257 Jul 23 2014 ecj-3.7.2.jar
-rw-r--r--. 1 root root 1796326 Jul 23 2014 ecj-4.2.1.jar
-rw-r--r--. 1 root root 46085 Jul 23 2014 el-api.jar
-rwxr-xr-x. 1 root root 21892 Jul 23 2014 fluent-hc-4.2.2.jar
-rwxr-xr-x. 1 root root 428353 Jul 23 2014 httpclient-4.2.2.jar
-rwxr-xr-x. 1 root root 115269 Jul 23 2014 httpclient-cache-4.2.2.jar
-rwxr-xr-x. 1 root root 223571 Jul 23 2014 httpcore-4.2.2.jar
-rwxr-xr-x. 1 root root 26594 Jul 23 2014 httpmime-4.2.2.jar
-rw-r--r--. 1 root root 125279 Jan 6 13:50 jasper-el.jar
-rw-r--r--. 1 root root 600391 Jan 6 13:50 jasper.jar
lrwxrwxrwx. 1 root root 23 Feb 18 21:50 jasper-jdt.jar -> /usr/share/java/ecj.jar
-rw-r-----. 1 root root 578790 Jun 18 2015 javax.mail.jar
-rw-r-----. 1 root root 23737 Jun 9 2015 json-simple-1.1.1.jar
-rw-r--r--. 1 root root 88691 Jul 23 2014 jsp-api.jar
-rwxr-xr-x. 1 root root 43858 Jul 23 2014 kxml2-2.3.0.jar
lrwxrwxrwx. 1 root root 25 Feb 18 21:50 log4j.jar -> /usr/share/java/log4j.jar
-rw-r--r--. 1 root root 177568 Jul 23 2014 servlet-api.jar
-rw-r--r--. 1 root root 586192 Jul 21 2015 sqljdbc41.jar
-rw-r--r--. 1 root root 212895 Jan 6 13:50 tomcat7-websocket.jar
-rw-r--r--. 1 root root 6918 Jan 6 13:50 tomcat-api.jar
-rw-r--r--. 1 root root 793503 Jan 6 13:50 tomcat-coyote.jar
lrwxrwxrwx. 1 root root 24 Feb 18 21:50 tomcat-el-2.2-api.jar -> ../tomcat-el-2.2-api.jar
-rw-r--r--. 1 root root 77568 Jan 6 13:50 tomcat-i18n-es.jar
-rw-r--r--. 1 root root 48323 Jan 6 13:50 tomcat-i18n-fr.jar
-rw-r--r--. 1 root root 50982 Jan 6 13:50 tomcat-i18n-ja.jar
-rw-r--r--. 1 root root 126977 Jan 6 13:50 tomcat-jdbc.jar
lrwxrwxrwx. 1 root root 25 Feb 18 21:50 tomcat-jsp-2.2-api.jar -> ../tomcat-jsp-2.2-api.jar
lrwxrwxrwx. 1 root root 37 Feb 18 21:50 tomcat-juli.jar -> /usr/share/tomcat/bin/tomcat-juli.jar
lrwxrwxrwx. 1 root root 29 Feb 18 21:50 tomcat-servlet-3.0-api.jar -> ../tomcat-servlet-3.0-api.jar
-rw-r--r--. 1 root root 33065 Jan 6 13:50 tomcat-util.jar
-rw-r--r--. 1 root root 36558 Jan 6 13:50 websocket-api.jar
But running afterward:
/etc/rc.d/init.d/tomcat restart
throws the following exception:
Stopping tomcat: /etc/rc.d/init.d/tomcat: line 209: /usr/share/java/tomcat/logs/tomcat-initd.log: No such file or directory
[FAILED]
Starting tomcat: [FAILED]
line 209 in /etc/init.d/tomcat
:
[ "$RETVAL" -eq "0" ] && $SU - $TOMCAT_USER -c "${TOMCAT_SCRIPT} stop" >> ${TOMCAT_LOG} 2>&1 || RETVAL="4"
What should these settings be in tomcat.conf? I cannot figure this out.
EDIT
following the suggestion from ALex_hha the following is encountered:
/etc/rc.d/init.d/tomcat restart
Stopping tomcat: [ OK ]
Starting tomcat: sed: can't read /usr/share/java/tomcat/conf/server.xml: No such file or directory
[ OK ]
Furthermore:
ls -all /usr/share/tomcat
total 36
drwxrwxr-x. 3 root tomcat 4096 Feb 19 16:23 .
drwxr-xr-x. 194 root root 4096 Feb 19 09:30 ..
-rw-------. 1 tomcat tomcat 1503 Jul 18 2014 .bash_history
drwxr-xr-x. 2 tomcat tomcat 4096 Feb 19 16:23 bin
lrwxrwxrwx. 1 root tomcat 11 Feb 19 16:23 conf -> /etc/tomcat
-rw-r--r--. 1 tomcat tomcat 7192 Sep 2 2014 .keystore
-rw-r--r--. 1 root root 3967 Sep 2 2014 .keystore-20140902
-rw-r--r--. 1 tomcat tomcat 5862 Aug 20 2014 .keystore-org
lrwxrwxrwx. 1 root tomcat 22 Feb 19 16:23 lib -> /usr/share/java/tomcat
lrwxrwxrwx. 1 root tomcat 15 Feb 19 16:23 logs -> /var/log/tomcat
lrwxrwxrwx. 1 root tomcat 22 Feb 19 16:23 temp -> /var/cache/tomcat/temp
lrwxrwxrwx. 1 root tomcat 23 Feb 19 16:23 webapps -> /var/lib/tomcat/webapps
lrwxrwxrwx. 1 root tomcat 22 Feb 19 16:23 work -> /var/cache/tomcat/work
server.xml (partial)
<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Is tomcat running?
sudo service tomcat status
PID file exists, but process is not running [WARNING]
tomcat lockfile exists but process is not running [FAILED]
As workaround you could try explicitly set path to the log file in the /etc/rc.d/init.d/tomcat
Replace
with
Should be
/usr/share/java/tomcat is incorrect path for CATALINA_BASE/CATALINA_HOME