-1
我正在學習Java Hibernate,但得到下面列出的錯誤。你能幫我找到我的錯誤嗎?謝謝。Java休眠錯誤ConfigurationException
Apr 11, 2017 11:32:46 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {5.2.9.Final}
Apr 11, 2017 11:32:46 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Failed to create sessionFactory object.org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]
Exception in thread "main" java.lang.ExceptionInInitializerError
at testhibernate.ManageEmployee.main(ManageEmployee.java:20)
Caused by: 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 testhibernate.ManageEmployee.main(ManageEmployee.java:17)
位於項目中的文件「hibernate.cfg.xml」在哪裏? – Jens
假設您將hibernate.cfg.xml文件添加到'src \ main \ webapp \ WEB-INF'文件夾,並將其引用到您的調度程序servlet中。 –
@ Jens hibernate.cfg.xml文件位於src/testhibernate /中,其中testhibernate是包裝 –