小弟用struts和hibernate时,运行结果报这样的错,那位达人能帮我解决一下,不胜感激
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
org.hibernate.MappingException: Error reading resource: domain/book_info.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
at bookdo.Test.main(Test.java:13)
Caused by: org.hibernate.MappingException: org.dom4j.DocumentException: D:\Documents and Settings\Administrator\workspace\final\hibernate-mapping-3.0.dtd (系统找不到指定的文件。) Nested exception: D:\Documents and Settings\Administrator\workspace\final\hibernate-mapping-3.0.dtd (系统找不到指定的文件。)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:408)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
... 7 more
Caused by: org.dom4j.DocumentException: D:\Documents and Settings\Administrator\workspace\final\hibernate-mapping-3.0.dtd (系统找不到指定的文件。) Nested exception: D:\Documents and Settings\Administrator\workspace\final\hibernate-mapping-3.0.dtd (系统找不到指定的文件。)
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398)
... 8 more
------解决方案--------------------
首先找到文件hibernate-mapping-3.0.dtd(通常在下载的Hibernate3的包中会有,MyEclipse也会有)并且复制到文件夹D:\Documents and Settings\Administrator\workspace\final\下,因为这个描述文件没有找到,所以所有.hbm.xml结尾的文件都不能被正常解析,结果就是不工作了..
另外,异常信息已经告诉你是什么问题了.仔细看看.
另外,记得结帐...