HIbernate错误...我在编译时收到此错误

时间:2014-07-02 10:02:45

标签: 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" org.hibernate.InvalidMappingException: Could not parse mapping document from resource employee.hbm.xml
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
    at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1584)
    at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1552)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1531)
    at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1505)
    at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
    at prac.StoreData.main(StoreData.java:13)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
    at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
    ... 6 more
Caused by: org.dom4j.DocumentException: Error on line 2 of document  : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    at org.dom4j.io.SAXReader.read(SAXReader.java:482)
    at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
    ... 7 more

1 个答案:

答案 0 :(得分:0)

employee.hbm.xml中必须存在语法错误