View Issue Details

IDProjectCategoryView StatusLast Update
0009097CentOS-7tomcatpublic2016-01-11 15:43
ReporterGarretICS 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0009097: tomcat-jsvc installed from yum fails to start
Descriptiontomcat-jsvc daemon for CentOS7 fails to start. Seems to successfully install the systemd unit file but the ExecStart file referenced does not exist
Steps To Reproduceyum install tomcat tomcat-jsvc
systemctl start tomcat = success

systemctl start tomcat-jsvc = failure:

$ systemctl status tomcat-jsvc.service
tomcat-jsvc.service - Apache Tomcat Web Application Container JSVC wrapper
   Loaded: loaded (/usr/lib/systemd/system/tomcat-jsvc.service; disabled)
   Active: failed (Result: exit-code) since Fri 2015-07-17 19:00:25 UTC; 15s ago
  Process: 19013 ExecStart=/usr/sbin/tomcat-jsvc-sysd start (code=exited, status=203/EXEC)
Additional Information# Systemd unit file for tomcat
#
# To create clones of this service:
# 1) By default SERVICE_NAME=tomcat. When cloned, the value must be defined
# before tomcat-sysd is called.
# 2) Create /etc/sysconfig/${SERVICE_NAME} from /etc/sysconfig/tomcat
# to override tomcat defaults

[Unit]
Description=Apache Tomcat Web Application Container JSVC wrapper
After=syslog.target network.target

[Service]
Type=forking
ExecStart=/usr/sbin/tomcat-jsvc-sysd start
ExecStop=/usr/sbin/tomcat-jsvc-sysd stop

[Install]
WantedBy=multi-user.target
TagsNo tags attached.
abrt_hash
URLhttps://www.centos.org/forums/viewtopic.php?f=48&t=53386&e=0

Activities

jja

jja

2015-11-03 19:54

reporter   ~0024774

actual executable "/usr/sbin/tomcat-jsvc-sysd" does not exist.

packages like tomcat-jsvc-7.0.55 and higher for other distros have this file.
jja

jja

2015-11-03 20:04

reporter   ~0024775

...in those other packages, /usr/sbin/tomcat-jsvc-sysd is just a symlink to "tomcat-sysd"

With the current tomcat packages, /usr/sbin/tomcat-jsvc-sysd should probably symlink to /usr/libexec/tomcat/server

Unfortunately, that will be less than useful as /usr/libexec/tomcat/functions harcodes the "-nodetach" option to jsvc. It should detach for start and -nodetach only for stop. In addition, the environment variable USE_JSVC would need to be set somewhere (perhaps /usr/lib/systemd/system/tomcat-jsvc.service)
jja

jja

2015-11-09 23:38

reporter  

tomcat-jsvc.service (648 bytes)
jja

jja

2015-11-09 23:39

reporter  

functions (1,298 bytes)
#!/bin/bash

if [ -r /usr/share/java-utils/java-functions ]; then
  . /usr/share/java-utils/java-functions
else
  echo "Can't read Java functions library, aborting"
  exit 1
fi

_save_function() {
  local ORIG_FUNC=$(declare -f $1)
  local NEWNAME_FUNC="$2${ORIG_FUNC#$1}"
  eval "$NEWNAME_FUNC"
}

run_jsvc() {
  JSVC=/usr/bin/jsvc
  if [ -x ${JSVC} ]; then
    TOMCAT_USER="tomcat"
    OUTFILE=${CATALINA_BASE}/logs/catalina${NAME}.out

    # pre-create the output file so we can change the owner so jsvc can later reopen it
    /usr/bin/touch ${OUTFILE}
    /usr/bin/chmod 0644 ${OUTFILE}
    if [ "$UID" = "0" ]; then
      /usr/bin/chown ${TOMCAT_USER} ${OUTFILE}

      # guess that there's a group of the same name, but ignore errors
      /usr/bin/chgrp ${TOMCAT_USER} ${OUTFILE} >/dev/null 2>&1 || true
    fi

    JSVC_OPTS="-pidfile /var/run/jsvc-tomcat${NAME}.pid -user ${TOMCAT_USER} -outfile ${OUTFILE} -errfile &1"
    if [ "$1" = "stop" ]; then
      JSVC_OPTS="${JSVC_OPTS} -nodetach -stop"
    fi

    exec "${JSVC}" ${JSVC_OPTS} ${FLAGS} -classpath "${CLASSPATH}" ${OPTIONS} "${MAIN_CLASS}" "${@}"
  else
    echo "Can't find ${JSVC} executable"
  fi
}

_save_function run run_java

run() {
   if [ "${USE_JSVC}" = "true" ] ; then
    run_jsvc $@
   else
    run_java $@
   fi
}
functions (1,298 bytes)
jja

jja

2015-11-09 23:39

reporter   ~0024805

I've added my working versions of:
/usr/lib/systemd/system/tomcat-jsvc.service
/usr/libexec/tomcat/functions
GarretICS

GarretICS

2016-01-11 15:43

reporter   ~0025324

I can confirm that creating the symlink as described, and replacing the two identified files with the modified versions attached, resulted in tomcat-jsvc.service starting properly. Thank you for the fix.

Issue History

Date Modified Username Field Change
2015-07-17 19:15 GarretICS New Issue
2015-11-03 19:54 jja Note Added: 0024774
2015-11-03 20:04 jja Note Added: 0024775
2015-11-09 23:38 jja File Added: tomcat-jsvc.service
2015-11-09 23:39 jja File Added: functions
2015-11-09 23:39 jja Note Added: 0024805
2016-01-11 15:43 GarretICS Note Added: 0025324