首页 > 编程语言 > 详细

Docker 发布springboot项目 启动报错 Unable to start web server

时间:2021-03-04 16:45:22      阅读:178      评论:0      收藏:0      [点我收藏+]

最近公司的测试服务都放在docker里面运行的,有个springboot在本地你能跑,发到服务器就启动不了。发现是DockerFile jdk环境配置错误了,开发环境和部署环境请保持一致。 

2021/3/4 上午10:45:13 org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2021/3/4 上午10:45:13 	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:545) ~[spring-context-5.2.13.RELEASE.jar!/:5.2.13.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at com.mall.hrfi.MallHrfiApplication.main(MallHrfiApplication.java:12) ~[classes!/:na]
2021/3/4 上午10:45:13 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
2021/3/4 上午10:45:13 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2021/3/4 上午10:45:13 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:na]
2021/3/4 上午10:45:13 	at java.base/java.lang.reflect.Method.invoke(Unknown Source) ~[na:na]
2021/3/4 上午10:45:13 	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[mall-hrfi.jar:na]
2021/3/4 上午10:45:13 	at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) ~[mall-hrfi.jar:na]
2021/3/4 上午10:45:13 	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[mall-hrfi.jar:na]
2021/3/4 上午10:45:13 	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[mall-hrfi.jar:na]
2021/3/4 上午10:45:13 Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2021/3/4 上午10:45:13 	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:440) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:193) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:158) ~[spring-boot-2.3.9.RELEASE.jar!/:2.3.9.RELEASE]
2021/3/4 上午10:45:13 	... 17 common frames omitted

  原来的dockerFile 

#jdk
FROM openjdk:11.0.7-jre-slim-buster

  修改后的

#jdk
FROM openjdk:8-slim-buster

 制作docker镜像的时候可以去这个网站看相关jdk镜像 https://hub.docker.com/_/openjdk

Docker 发布springboot项目 启动报错 Unable to start web server

原文:https://www.cnblogs.com/dadadajiong/p/14480173.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!