【发布时间】:2016-06-23 06:58:57
【问题描述】:
我使用java -jar xxx.jar 启动我的 Spring Boot web 应用程序,但运行一段时间后应用程序自行关闭。这是 --debug 日志
22:55:36.187 [http-nio-7082-exec-10] DEBUG o.s.web.servlet.DispatcherServlet - Successfully completed request
22:55:36.187 [http-nio-7082-exec-10] DEBUG o.s.b.c.w.OrderedRequestContextFilter - Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@40d2cb04
01:06:52.227 [Thread-4] INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@633761b6: startup date [Tue Mar 08 22:54:54 CST 2016]; root of context hierarchy
01:06:52.229 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'lifecycleProcessor'
01:06:52.229 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2db493c7: defining beans [......]; root of factory hierarchy
01:06:52.234 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'mbeanExporter'
01:06:52.234 [Thread-4] INFO o.s.j.e.a.AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown
01:06:52.238 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'mvcValidator'
01:06:52.242 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean '(inner bean)#62a4e999': [tzsUserDao]
01:06:52.242 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean '(inner bean)#38e46e67': [(inner bean)#62a4e999]
01:06:52.243 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean '(inner bean)#7a25d5eb': [tzsUserActionDao]
01:06:52.243 [Thread-4] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Retrieved dependent beans for bean '(inner bean)#2298ca79': [(inner bean)#7a25d5eb]
01:06:52.244 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'jpaMappingContext'
01:06:52.244 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'entityManagerFactory'
01:06:52.245 [Thread-4] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
01:06:52.245 [Thread-4] DEBUG o.h.internal.SessionFactoryImpl - HHH000031: Closing
01:06:52.245 [Thread-4] DEBUG o.h.s.i.AbstractServiceRegistryImpl - Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries
01:06:52.246 [Thread-4] DEBUG o.h.b.r.i.BootstrapServiceRegistryImpl - Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries
01:06:52.246 [Thread-4] DEBUG o.h.j.i.EntityManagerFactoryRegistry - Remove: name=default
01:06:52.246 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'httpPutFormContentFilter'
01:06:52.246 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'hiddenHttpMethodFilter'
01:06:52.247 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'requestContextFilter'
01:06:52.248 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'characterEncodingFilter'
01:06:52.249 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy method 'close' on bean with name 'dataSource'
01:06:52.254 [Thread-4] DEBUG o.s.b.f.s.DisposableBeanAdapter - Invoking destroy() on bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor'
【问题讨论】:
-
看看这个,可能是类似的问题:stackoverflow.com/questions/22380119/…
-
查看其他堆栈溢出问题:您应该添加代码(或其中的一部分),否则很难理解出错的原因,或者一般来说,您的问题的上下文。
-
根据
Thread-4判断,我猜想这是关闭应用程序上下文的JVM 关闭挂钩。这意味着有东西要求 JVM 关闭。如果没有更多信息,就不可能说出那是什么。如果你在 Linux 上运行,它可能是 OOM Killer,虽然我不确定它是否发送SIGTERM会运行所有关闭挂钩,或者发送SIGKILL不会。
标签: spring spring-boot