【報錯】HibernateException:hibernate.cfg.xml not found
【報錯】
log4j:WARN No appenders could be found for logger (org.hibernate.type.BasicTypeRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" org.hibernate.HibernateException: /hibernate.cfg.xml not found
at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2176)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2157)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2137)
at com.tgbnode.hibernate.Client.main(Client.java:14)
【解決】
configuration 預設的尋找的 hibernate 配置檔案是在 src 目錄下的 hibernate.cfg.xml別把它放在 src 下的目錄裡