美文网首页
spring boot项目部署到tomcat报"Cau

spring boot项目部署到tomcat报"Cau

作者: nextliving | 来源:发表于2018-10-29 19:12 被阅读27次

今天把spring boot项目部署到tomcat时遇到一个错误:

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader

导致服务一直启动。stackoverflow上的这个问题# Deployed Spring boot Application in tomcat提到是因为application.properties中management下配置的端口和部署到的tomcat服务器端口不一致导致的。于是查看项目中的application.yml配置文件,找到以下配置项:

#management:
#  endpoints:
#    web:
#      exposure:
#        include: "*"
#  endpoint:
#    shutdown:
#      enabled: true
#  server:
#    address: 127.0.0.1
#    port: 24003
#    servlet:
#      context-path: /

这里port是24003,而我要部署到的tomcat的端口是8080。因为这2个端口不一致,导致尝试启动内置的tomcat,但是又没有在pom.xml中配置tomcat,因此出现开头的错误。将mangement部分注释掉,重新打包部署,项目完美启动。

相关文章

网友评论

      本文标题:spring boot项目部署到tomcat报"Cau

      本文链接:https://www.haomeiwen.com/subject/uxritqtx.html