简体   繁体   English

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

[英]Hibernate SessionFactory creation failure when running JUnit tests only

I'm using Eclipse and Hibernate to develope a J2EE web app. 我正在使用Eclipse和Hibernate开发J2EE Web应用程序。 When running/debugging the web app, my hibernate-related code works just fine. 在运行/调试Web应用程序时,与休眠相关的代码可以正常工作。 But if I run a junit test that tests some of my hibernate-related code, I get an "Initial SessionFactory creation failed" error. 但是,如果我运行一个junit测试来测试一些与休眠相关的代码,则会收到“初始SessionFactory创建失败”错误。

The specific error message is as follows: Initial SessionFactory creation failed.java.lang.NoSuchMethodError: org.hibernate.persister.collection.OneToManyPersister.(Lorg/hibernate/mapping/Collection;Lorg/hibernate/cache/access/CollectionRegionAccessStrategy;Lorg/hibernate/cfg/Configuration;Lorg/hibernate/engine/SessionFactoryImplementor;)V 具体错误消息如下:初始SessionFactory创建失败。java.lang.NoSuchMethodError:org.hibernate.persister.collection.OneToManyPersister。 hibernate / cfg / Configuration; Lorg / hibernate / engine / SessionFactoryImplementor;)V

Any comments or solutions are greatly appreciated! 任何意见或解决方案,不胜感激!

听起来好像您是在与编译版本不同的Hibernate库版本上运行单元测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM