有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

仅运行JUnit测试时java Hibernate SessionFactory创建失败

我正在使用Eclipse和Hibernate开发一个J2EE web应用程序。 运行/调试web应用程序时,我的hibernate相关代码工作正常。 但是如果我运行一个junit测试来测试一些与hibernate相关的代码,我会得到一个“Initial SessionFactory creation failed”错误

具体错误消息如下: 初始SessionFactory创建失败。JAVAlang.NoSuchMethodError:org。冬眠坚持者。收集唯一的坚持者。(Lorg/hibernate/mapping/Collection;Lorg/hibernate/cache/access/CollectionRegion访问策略;Lorg/hibernate/cfg/Configuration;Lorg/hibernate/engine/SessionFactoryImplementor;)五

非常感谢您的任何意见或解决方案


共 (1) 个答案

  1. # 1 楼答案

    听起来您正在对Hibernate库的不同版本运行单元测试,而不是编译它