3
firends IM使用NetBeans IDE和在默認的src/java文件夾 其放置的hibernate.cfg.xml但每當我運行該應用程序其下面顯示錯誤:初始會話工廠創建失敗休眠錯誤
Initial SessionFactory creation failed.org.hibernate.HibernateException: /hibernate.cfg.xml not found
類:
public class myutil {
private static final SessionFactory sessionFactory = buildsf();
public static SessionFactory buildsf() {
try {
// Create the SessionFactory from standard (hibernate.cfg.xml)
return new Configuration().configure("config/hibernate.cfg.xml").buildSessionFactory();
} catch (Throwable ex) { // Log the exception.
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
}
config目錄我需要創建嗎? –
好吧,保持單獨的包/目錄配置。你也可以在那裏給你的路。 –
非常感謝你的兄弟 –