前端之家收集整理的这篇文章主要介绍了ConfigurationException:无法在项目根文件夹中找到cfg.xml资源[hibernate.cfg.xml],前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我运行的应用程序包含:
SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();
它使用以下消息在configure()方法中崩溃:
Could not locate cfg.xml resource [hibernate.cfg.xml]
输出:
Jun 17,2016 12:04:59 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {5.2.0.Final} Jun 17,2016 12:04:59 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000205: Loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=org.h2.Driver,hibernate.service.allow_crawling=false,hibernate.max_fetch_depth=5,hibernate.dialect=org.hibernate.dialect.H2Dialect,hibernate.format_sql=true,hibernate.generate_statistics=true,hibernate.connection.username=sa,hibernate.connection.url=jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=10000,hibernate.bytecode.use_reflection_optimizer=false,hibernate.connection.password=****,hibernate.connection.pool_size=5} Jun 17,2016 12:04:59 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml] at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53) at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163) at org.hibernate.cfg.Configuration.configure(Configuration.java:258) at org.hibernate.cfg.Configuration.configure(Configuration.java:244) at o.k.j.HibernateTest.main(HibernateTest.java:22)
以上是前端之家为你收集整理的ConfigurationException:无法在项目根文件夹中找到cfg.xml资源[hibernate.cfg.xml]全部内容,希望文章能够帮你解决ConfigurationException:无法在项目根文件夹中找到cfg.xml资源[hibernate.cfg.xml]所遇到的程序开发问题。
如果觉得前端之家网站内容还不错,欢迎将前端之家网站推荐给前端开发程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。