Tomcat 关闭报错:Tomcat did not stop in time. PID file w(4)

通过设置echo提示信息,找到报错执行语句,大家看到报错的真正原因是在于执行这一句:
/usr/lib/jvm/java/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms512m -Xmx1024m -Xss1024K -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+PrintGCDetails -Xloggc:/logs/gc/9300.gc -Djava.endorsed.dirs=/usr/local/app/apache-tomcat-6.0.37_9300/endorsed -classpath /usr/local/app/apache-tomcat-6.0.37_9300/bin/bootstrap.jar -Dcatalina.base=/usr/local/app/apache-tomcat-6.0.37_9300 -Dcatalina.home=/usr/local/app/apache-tomcat-6.0.37_9300 -Djava.io.tmpdir=/usr/local/app/apache-tomcat-6.0.37_9300/temp org.apache.catalina.startup.Bootstrap stop后报错。1
对于catalina.sh里面的就是这一句:
 echo "0000002"
  "$_RUNJAVA" $LOGGING_MANAGER $JAVA_OPTS \
    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    -Dcatalina.base="$CATALINA_BASE" \
    -Dcatalina.home="$CATALINA_HOME" \
    -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    org.apache.catalina.startup.Bootstrap "$@" stop

echo "0000003"

3.3.2 再次等5分钟,再bash -x看执行详细过程:
    [root@ptbin]# bash -x catalina.sh stop
    + JAVA_OPTS='-Xms512m -Xmx1024m -Xss1024K -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+PrintGCDetails -Xloggc:/logs/gc/9300.gc'
    + CATALINA_PID=/var/tomcat/9300.pid
    + cygwin=false
    + os400=false
    + darwin=false
    + case "`uname`" in
    ++ uname
    + PRG=catalina.sh
    + '[' -h catalina.sh ']'
    ++ dirname catalina.sh
    + PRGDIR=.
    + '[' -z '' ']'
    ++ cd ./..
    ++ pwd
    + CATALINA_HOME=/usr/local/app/apache-tomcat-6.0.37_9300
    + '[' -z '' ']'
    + CATALINA_BASE=/usr/local/app/apache-tomcat-6.0.37_9300
    + CLASSPATH=
    + '[' -r /usr/local/app/apache-tomcat-6.0.37_9300/bin/setenv.sh ']'
    + '[' -r /usr/local/app/apache-tomcat-6.0.37_9300/bin/setenv.sh ']'
    + false
    + false
    + false
    + '[' -r /usr/local/app/apache-tomcat-6.0.37_9300/bin/setclasspath.sh ']'
    + BASEDIR=/usr/local/app/apache-tomcat-6.0.37_9300
    + . /usr/local/app/apache-tomcat-6.0.37_9300/bin/setclasspath.sh
    ++ '[' -z /usr/lib/jvm/java -a -z '' ']'
    ++ '[' -z /usr/lib/jvm/java -a stop = debug ']'
    ++ '[' -z '' ']'
    ++ JRE_HOME=/usr/lib/jvm/java
    ++ '[' stop = debug ']'
    ++ '[' -z /usr/local/app/apache-tomcat-6.0.37_9300 ']'
    ++ '[' '!' -x /usr/local/app/apache-tomcat-6.0.37_9300/bin/setclasspath.sh ']'
    ++ '[' -z '' ']'
    ++ JAVA_ENDORSED_DIRS=/usr/local/app/apache-tomcat-6.0.37_9300/endorsed
    ++ JIKESPATH=
    +++ uname -s
    ++ '[' Linux = Darwin ']'
    ++ _RUNJAVA=/usr/lib/jvm/java/bin/java
    ++ '[' false '!=' true ']'
    ++ _RUNJDB=/usr/lib/jvm/java/bin/jdb
    + '[' -z /usr/local/app/apache-tomcat-6.0.37_9300 ']'
    + '[' '!' -z '' ']'
    + '[' /usr/local/app/apache-tomcat-6.0.37_9300 '!=' /usr/local/app/apache-tomcat-6.0.37_9300 ']'
    + CLASSPATH=/usr/local/app/apache-tomcat-6.0.37_9300/bin/bootstrap.jar
    + '[' -z '' ']'
    + CATALINA_OUT=/usr/local/app/apache-tomcat-6.0.37_9300/logs/catalina.out
    + '[' -z '' ']'
    + CATALINA_TMPDIR=/usr/local/app/apache-tomcat-6.0.37_9300/temp
    + have_tty=0
    ++ tty
    + '[' /dev/pts/1 '!=' 'not a tty' ']'
    + have_tty=1
    + false
    + '[' -z '' ']'
    + '[' -r /usr/local/app/apache-tomcat-6.0.37_9300/conf/logging.properties ']'
    + LOGGING_CONFIG=-Djava.util.logging.config.file=/usr/local/app/apache-tomcat-6.0.37_9300/conf/logging.properties
    + '[' -z '' ']'
    + LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    + '[' 1 -eq 1 ']'
    + echo 'Using CATALINA_BASE:  /usr/local/app/apache-tomcat-6.0.37_9300'
    Using CATALINA_BASE:  /usr/local/app/apache-tomcat-6.0.37_9300
    + echo 'Using CATALINA_HOME:  /usr/local/app/apache-tomcat-6.0.37_9300'
    Using CATALINA_HOME:  /usr/local/app/apache-tomcat-6.0.37_9300
    + echo 'Using CATALINA_TMPDIR: /usr/local/app/apache-tomcat-6.0.37_9300/temp'
    Using CATALINA_TMPDIR: /usr/local/app/apache-tomcat-6.0.37_9300/temp
    + '[' stop = debug ']'
    + echo 'Using JRE_HOME:        /usr/lib/jvm/java'
    Using JRE_HOME:        /usr/lib/jvm/java
    + echo 'Using CLASSPATH:      /usr/local/app/apache-tomcat-6.0.37_9300/bin/bootstrap.jar'
    Using CLASSPATH:      /usr/local/app/apache-tomcat-6.0.37_9300/bin/bootstrap.jar
    + '[' '!' -z /var/tomcat/9300.pid ']'
    + echo 'Using CATALINA_PID:    /var/tomcat/9300.pid'
    Using CATALINA_PID:    /var/tomcat/9300.pid
    + '[' stop = jpda ']'
    + '[' stop = debug ']'
    + '[' stop = run ']'
    + '[' stop = start ']'
    + '[' stop = stop ']'
    + shift
    + SLEEP=5
    + '[' '!' -z '' ']'
    + FORCE=0
    + '[' '' = -force ']'
    + '[' '!' -z /var/tomcat/9300.pid ']'
    + '[' -f /var/tomcat/9300.pid ']'
    + '[' -s /var/tomcat/9300.pid ']'
    ++ cat /var/tomcat/9300.pid
    + kill -0 23685
    + '[' 0 -gt 0 ']'
    + echo 0000002
    0000002
    + /usr/lib/jvm/java/bin/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms512m -Xmx1024m -Xss1024K -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+PrintGCDetails -Xloggc:/logs/gc/9300.gc -Djava.endorsed.dirs=/usr/local/app/apache-tomcat-6.0.37_9300/endorsed -classpath /usr/local/app/apache-tomcat-6.0.37_9300/bin/bootstrap.jar -Dcatalina.base=/usr/local/app/apache-tomcat-6.0.37_9300 -Dcatalina.home=/usr/local/app/apache-tomcat-6.0.37_9300 -Djava.io.tmpdir=/usr/local/app/apache-tomcat-6.0.37_9300/temp org.apache.catalina.startup.Bootstrap stop
    + echo 0000003
    0000003
    + '[' '!' -z /var/tomcat/9300.pid ']'
    + echo CATALINA_PID:/var/tomcat/9300.pid
    CATALINA_PID:/var/tomcat/9300.pid
    + '[' -f /var/tomcat/9300.pid ']'
    + '[' 5 -ge 0 ']'
    ++ cat /var/tomcat/9300.pid
    + kill -0 23685
    + '[' 0 -gt 0 ']'
    + '[' 5 -gt 0 ']'
    + sleep 1
    + '[' 5 -eq 0 ']'
    ++ expr 5 - 1
    + SLEEP=4
    + '[' 4 -ge 0 ']'
    ++ cat /var/tomcat/9300.pid
    + kill -0 23685
    + '[' 0 -gt 0 ']'
    + '[' 4 -gt 0 ']'
    + sleep 1
    + '[' 4 -eq 0 ']'
    ++ expr 4 - 1
    + SLEEP=3
    + '[' 3 -ge 0 ']'
    ++ cat /var/tomcat/9300.pid
    + kill -0 23685
    + '[' 0 -gt 0 ']'
    + '[' 3 -gt 0 ']'
    + sleep 1
    + '[' 3 -eq 0 ']'
    ++ expr 3 - 1
    + SLEEP=2
    + '[' 2 -ge 0 ']'
    ++ cat /var/tomcat/9300.pid
    + kill -0 23685
    + '[' 0 -gt 0 ']'
    + '[' 2 -gt 0 ']'
    + sleep 1
    + '[' 2 -eq 0 ']'
    ++ expr 2 - 1
    + SLEEP=1
    + '[' 1 -ge 0 ']'
    ++ cat /var/tomcat/9300.pid
    + kill -0 23685
    + '[' 1 -gt 0 ']'
    + rm -f /var/tomcat/9300.pid
    + '[' 0 '!=' 0 ']'
    + break
    + '[' 0 -eq 1 ']'1
对比下3.3.1代码报错的代码以及bash执行结果命令,   
    "$_RUNJAVA" $LOGGING_MANAGER $JAVA_OPTS \
    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    -Dcatalina.base="$CATALINA_BASE" \
    -Dcatalina.home="$CATALINA_HOME" \
    -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    org.apache.catalina.startup.Bootstrap "$@" stop

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4f0bdba19ba516edd3c44a3991017896.html