今天启动项目时遇到一个错误,找了半天才找到,现在总结下遇到这个问题如何解决.错误如下:
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:555)
at org.springframework.orm.hibernate3.LocalSessionfactorybean.buildSessionFactory(LocalSessionfactorybean.java:677)
at org.springframework.orm.hibernate3.AbstractSessionfactorybean.afterPropertiesSet(AbstractSessionfactorybean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.invokeInitMethods(AbstractAutowireCapablebeanfactory.java:1460)
at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1400)
... 46 more
Caused by: org.dom4j.DocumentException: Error on line 26 of document : Content is not allowed in trailing section. Nested exception: Content is not allowed in trailing section.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:546)
... 50 more
2013-9-10 9:36:31 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
原因如下:
1.xml内容不正确,原来是我在后面多加了个s,
2.如果结束时有空格也会出现类似问题.
希望今后不会再犯类似的错,写 xml时要细心点.希望能对大家有帮助.