栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

java.lang.NoClassDefFoundError:org / springframework / transaction /interceptor / TransactionInterce

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

java.lang.NoClassDefFoundError:org / springframework / transaction /interceptor / TransactionInterce

通常,当您在编译时拥有该类但在运行时不存在该类时,便会出现NoClassDef错误。请彻底检查您的Maven依赖项是否存在任何jar冲突。这可能是NoClassDef的可能原因。检查pom.xml并导航到“依赖关系层次结构”选项卡,以验证是否两次都看不到相同的jar,但版本不同。

如果确实有jar冲突,则必须根据使用特定版本的要求删除其中之一

您也可以通过命令行检查依赖关系树。

例如,要了解为什么Maven依赖插件使用Commons Collections 2.0,我们可以在项目目录中执行以下命令:

mvn dependency:tree -Dverbose -Dincludes=commons-collections

这是官方的Maven依赖插件

编辑:直接从Maven依赖插件页面。我认为这将使答案更具描述性,而不是单击几个链接。

官方页面上显示的一个很好的例子,说明了如何使用依赖树来解决冲突

例如,要了解为什么Maven依赖插件使用Commons Collections 2.0,我们可以在项目目录中执行以下命令:

mvn dependency:tree -Dverbose -Dincludes=commons-collectionsThe verbose flag instructs the dependency tree to display conflicting dependencies that were omitted from the resolved dependency tree. In this case, the goal outputs:[INFO] [dependency:tree][INFO] org.apache.maven.plugins:maven-dependency-plugin:maven-plugin:2.0-alpha-5-SNAPSHOT[INFO] +- org.apache.maven.reporting:maven-reporting-impl:jar:2.0.4:compile[INFO] |  - commons-validator:commons-validator:jar:1.2.0:compile[INFO] |     - commons-digester:commons-digester:jar:1.6:compile[INFO] |        - (commons-collections:commons-collections:jar:2.1:compile - omitted for conflict with 2.0)[INFO] - org.apache.maven.doxia:doxia-site-renderer:jar:1.0-alpha-8:compile[INFO]    - org.prehaus.plexus:plexus-velocity:jar:1.1.3:compile[INFO]       - commons-collections:commons-collections:jar:2.0:compileThus we can see that Commons Collections 2.0 was chosen over 2.1 since it is nearer, and by default Maven resolves version conflicts with a nearest-wins strategy.More specifically, in verbose mode the dependency tree shows dependencies that were omitted for: being a duplicate of another; conflicting with another's version and/or scope; and introducing a cycle into the dependency tree.


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/381155.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号