Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
我该如何解决这个问题?
谢谢!
答案 0 :(得分:6)
您需要更改第二个应用程序使用的端口(以避免同一TCP端口的冲突)。 一种方法是添加像
这样的属性server.port = 8090
到第二个应用程序的application.properties
答案 1 :(得分:5)
另一种方法是将端口指定为命令行开关。这样可以更容易地在运行时操作,而无需还原到属性设置,这些属性设置最终可能对您部署到的环境有效或无效。
java -Dserver.port=8081 -jar target/springboot-0.0.1-SNAPSHOT.jar