项目自动挂掉 root of context hierarchy

项目自动挂掉

  • 这个问题出现在我在使用spring-cloud的时候,在服务器上搭建自己的sentinel-dashboard客户端,发现每次启动的时候都能够成功启动,但是第二天或者间隔一段时间服务就会自己挂掉。查看后台日志:
    发现总是自动停止
    报错如下:
2021-03-18 19:29:23.525  INFO 2892 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2021-03-18 19:29:23.994  INFO 2892 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2021-03-18 19:29:24.248  INFO 2892 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-03-18 19:29:24.269  INFO 2892 --- [           main] c.a.c.s.dashboard.DashboardApplication   : Started DashboardApplication in 10.359 seconds (JVM running for 11.9)
2021-03-18 19:29:50.548  INFO 2892 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2021-03-18 19:29:50.560  INFO 2892 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2021-03-18 19:29:50.646  INFO 2892 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 86 ms
2021-03-18 19:32:43.291  WARN 2892 --- [nio-8080-exec-4] o.a.c.util.SessionIdGeneratorBase        : Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [170,434] milliseconds.
2021-03-18 22:58:07.851  INFO 2892 --- [       Thread-6] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@567d299b: startup date [Thu Mar 18 19:29:15 CST 2021]; root of context hierarchy
2021-03-18 22:58:07.878  INFO 2892 --- [       Thread-6] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

查找原因后发现自己犯了一个比较初级的错误
使用的启动命令是

java -jar sentinel-dashboard-1.8.0.jar>>/data/logs/sentinel/sentinel-8080.log  2>&1 &

而没有使用nohup启动,导致远程关闭的时候服务也就停止了
应该使用

nohup java -jar sentinel-dashboard-1.8.0.jar>>/data/logs/sentinel/sentinel-8080.log  2>&1 &

命令完成启动,解决这个问题。

你可能感兴趣的:(linux,spring-cloud,java,spring,linux)