如何解决hibernate映射异常

时间:2014-03-28 14:24:32

标签: java hibernate

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.hiberPack.Lab1Client1.main(Lab1Client1.java:13)
Caused by: org.hibernate.MappingException: Resource: com/jlcindia/hibernate/Customer.hbm.xml not found
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:442)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1381)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1353)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1335)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1302)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
    at com.hiberPack.CHibernateUtil.<clinit>(CHibernateUtil.java:10)
    ... 1 more

1 个答案:

答案 0 :(得分:0)

您的Customer.hbm.xmllog4j.properties都丢失了。 您必须将这些文件放在类路径中,例如在资源文件夹