我正在使用Eclipse和Hibernate开发J2EE Web应用程序。 运行/调试Web应用程序时,我的hibernate相关代码工作得很好。 但是,如果我运行一个junit测试,测试一些与我的hibernate相关的代码,我得到一个“Initial SessionFactory创建失败”的错误。仅在运行JUnit测试时发生Hibernate SessionFactory创建失败
特定错误消息如下所示: 初始会话工厂创建failed.java.lang.NoSuchMethodError:org.hibernate.persister.collection.OneToManyPersister(Lorg /休眠/映射/收藏; Lorg /休眠/高速缓存/接入/ CollectionRegionAccessStrategy; Lorg/hibernate/cfg/Configuration; Lorg/hibernate/engine/SessionFactoryImplementor;)V
任何意见或解决方案都非常感谢!
这将是很好的展示你如何为你的测试初始化sessionFactory。 – 2011-03-30 19:18:18