springboot打包部署到tomcat缺少jar包
问题描述
javaweb项目springboot使用的jetty容器,本地使用jetty容器运行没有问题,部署到linux服务器报错,有如下报错信息:
- 项目部署到线上http://www.it399.com 之后发现访问报错,看提示说log4j-api-2.1.jar (No such file or directory) 等jar包缺失
- 到线上http://www.it399.com 报错The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
排查之后发现是因为jar冲突导致的
需要将jetty相关的依赖改成
<scope>provided</scope>
也就是打成war包的时候jetty相关的jar包不会打进去。