为什么我的Spring Boot应用程序自行关闭

时间:2016-03-09 03:46:24

标签: spring spring-boot

我使用java -jar xxx.jar启动Spring Boot webapp,但运行一段时间后应用程序自行关闭。这是--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'

1 个答案:

答案 0 :(得分:3)

我知道原因:因为我使用

启动了Spring Boot webapp
java -jar xxx.jar

但是当我以

开始时
nohup java -jar xxx.jar

应用程序将运行正确,并且在SSH会话终止时不会被终止。

相关问题