---
title: "Tomcat无法shutdown进程问题解决办法"
author: "fengqinyun"
date: "2013-06-09T10:38:57Z"
tags: []
categories: ["开源软件"]
slug: "tomcat-shutdown"
draft: false
lastmod: "2013-06-09T10:41:41Z"
id: 1884736
url: "https://stevenfeng.iteye.com/blog/1884736"
---

```java

tomcat无法shutdown，shutdown之后还有一些进程没有释放导致jvm还在活动。
 
解决：程序中的线程设置为守护线程：setDaemon（true）
在servlet 中 destroy方法里面自己销毁线程
 
如果是spring则在bean后面配置 destroy-method="destroy" 

```


```java


1.kill -9 pid
2.要是嫌这样太麻烦了，可以如下这样改：

==============================bin/shutdown.sh 
exec "$PRGDIR"/"$EXECUTABLE" stop  -force "$@"  #加上 -force  
 
==============================bin/catalina.sh  
在PRGDIR=`dirname "$PRG"`后面加上
if [ -z "$catalina_pid" ]; then
      CATALINA_PID=$PRGDIR/CATALINA_PID
      cat $CATALINA_PID
fi

pstree -p 可以查看后台进程

```