程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> 項目啟動時報錯Element type "property" must be followed by either attri

項目啟動時報錯Element type "property" must be followed by either attri

編輯:關於JAVA

項目啟動時報錯Element type "property" must be followed by either attribute specifications, ">" or "/>"

項目啟動時,控制台報錯,信息如下(有刪減):

Error creating bean with name 'supplierInfoDAO' defined in class path resource [conf/applicationContext-hibernate.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [conf/applicationContext-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream

... 79 more

Caused by: org.dom4j.DocumentException: Error on line 138 of document  : Element type "property" must be followed by either attribute specifications, ">" or "/>". Nested exception: Element type "property" must be followed by either attribute specifications, ">" or "/>".

at org.dom4j.io.SAXReader.read(SAXReader.java:482)

at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:532)

... 83 more

錯誤信息指向的文檔信息如下:

138行是正確的配置,怎麼看都沒有問題, 想當然的認為,不可能是空格的問題,結果出人意料,就 是因為屬性之間缺少了一個空格,導致SAX解析XML文件時報錯導致,將文件修改為如下即可

項目運行正常了。

查看本欄目

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved