Springboot-NoClassDefFoundError: org/eclipse/jetty/server/session/SessionDataStore
在使用Springboot,部署到外部tomcat时报了Springboot-NoClassDefFoundError: org/eclipse/jetty/server/session/SessionDataStore
这样的错误,处理过程记录如下。
-
搜搜搜
无结果,都没有相同遇到相同问题的人出现。 -
分析原因
本地idea跑没问题,放到测试机上的外部tomcat就不行,推测是包冲突?或是tomcat少包。在idea通过依赖分析查到了报错的代码行,找到了该包是jetty-all
这个artifact内的,而且是因为项目用了hive-jdbc
传递依赖进来的。 -
解决方法
将该冗余的jetty依赖去掉:<dependency> <groupId>org.apache.hive</groupId> <artifactId>hive-jdbc</artifactId> <version>${hive-jdbc.version}</version> <exclusions> <exclusion> <groupId>org.eclipse.jetty.aggregate</groupId> <artifactId>jetty-all</artifactId> </exclusion> </exclusions> </dependency>
重新打包,上传,运行,OK了。