当前位置: 首页 > 知识库问答 >
问题:

Spring Stack Web-Tomcat 7上的应用程序没有停止(需要强制杀死)

百里疏珂
2023-03-14

有什么想法为什么这可以阻止tomcat关闭吗?

编辑:关于进一步的建议和分析-看起来apache HTTP客户机正在使用DateUtils类,该类反过来创建一个ThreadLocal实例…我们的代码使用HTTP客户机对外部服务进行分类...当然,如果它存在于Apache HTTP客户机中,这应该是一个非常常见的问题,因为使用它来调用外部HTTPendpoint并不罕见??

日志输出下的Threaddump

伊恩。

-2013-01-04 09:18:33,189 DEBUG [http-bio-9999-exec-8] view.InternalResourceView (InternalResourceView.java:236) - Forwarding to resource [/WEB-INF/views/auth/login.jsp] in InternalResourceView 'auth/login'
2013-01-04 09:18:33,191 DEBUG [http-bio-9999-exec-8] servlet.FrameworkServlet (FrameworkServlet.java:913) - Successfully completed request
Jan 04, 2013 9:18:33 AM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
Jan 04, 2013 9:18:33 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-9999"]
Jan 04, 2013 9:18:33 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jan 04, 2013 9:18:33 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
2013-01-04 09:18:33,409 INFO  [localhost-startStop-2] support.AbstractApplicationContext (AbstractApplicationContext.java:1025) - Closing WebApplicationContext for namespace 'test-servlet': startup date [Thu Jan 03 17:56:22 GMT 2013]; parent: Root WebApplicationContext
2013-01-04 09:18:33,409 DEBUG [localhost-startStop-2] support.AbstractBeanFactory (AbstractBeanFactory.java:245) - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalScheduledAnnotationProcessor'
2013-01-04 09:18:33,410 DEBUG [localhost-startStop-2] support.AbstractBeanFactory (AbstractBeanFactory.java:245) - Returning cached instance of singleton bean 'lifecycleProcessor'
2013-01-04 09:18:33,410 INFO  [localhost-startStop-2] support.DefaultSingletonBeanRegistry (DefaultSingletonBeanRegistry.java:433) - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@37f293d3: defining beans []; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@2f701b4e
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.AnnotationConfigWebApplicationContext).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jan 04, 2013 9:18:33 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Jan 04, 2013 9:18:33 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [] created a ThreadLocal with key of type [org.apache.http.impl.cookie.DateUtils$DateFormatHolder$1] (value [org.apache.http.impl.cookie.DateUtils$DateFormatHolder$1@3f94bcde]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@3dfbb36e]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Jan 04, 2013 9:18:33 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-9999"]
Jan 04, 2013 9:18:33 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Jan 04, 2013 9:18:33 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-9999"]
Jan 04, 2013 9:18:33 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]

--线程转储----

在org.apache.http.impl.cookie.dateUtils$dateformatholder$1.InitialValue(Dateutils.java:220)在org.apache.http.impl.cookie.dateeutils.java:219)在java.lang.threadlocal.setInitialValue(threadlocal.java:160)
在java.lang.threadlocal.get(threadlocal.java:150)在org.apache.http.impl.cookie.dateUtils.java:239)在(dateutils.java:156)
在org.apache.http.impl.cookie.dateutils.parsedate(dateutils.java:114)在org.apache.http.impl.cookie.basicexpireshandler.parse(basicexpireshandler.java:61)在org.apache.http.impl.cookie.cookiespase.parse(cookiespecbase.java:93),在org.apache.http.impl.cookie.bestmatchspec.parse(protocol.responseProcesscookies.process(responseProcesscookies.java:95),地址为org.apache.http.pr在org.apache.http.protocol.httprequestExecutor.PostProcess(httprequestExecutor.java:342)在org.apache.http.impl.client.defaultRequestDirector.execute(DefaultRequestDirector.java:462)在org.apache.http.impl.client.abstractHttpClient.execute(abstractHttpClient.java:820)在execute(AbstractHttpClient.java:732)

共有1个答案

仇航
2023-03-14

您的代码似乎在某个时候使用了[org.apache.http.impl.cookie.dateutils$dateformatholder$]。这个老问题表明HttpClient可能正在发出引用。

因此,您需要使用HttpClient查找代码,并确保清除ContextDestroy上的任何线程或与HttpClient相关的资源。

查看应用程序中使用HttpClient的线程,您应该验证这些线程在关机时是否正确停止。

 类似资料: