我在使用hibernate时候,遇到了这样的问题:截图如下
org.dom4j.DocumentException:Erroronline42ofdocument:Thestring"--"isnotpermittedwithin...
org.dom4j.DocumentException: Error on line 42 of document : The string "--" is not permitted within comments. Nested exception: The string "--" is not permitted within comments. 由于网速问题,图片没能传上去。无论哪个hibernate测试文件,都会报这同样的错误,即使原来的某个可以正常执行,但是不知道为啥,现在就不行了,真是无奈。求解决,谢谢了啊!!!
下面是全部的报错代码:
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at base.Test.add(Test.java:92)
at base.Test.main(Test.java:20)
Caused by: org.dom4j.DocumentException: Error on line 42 of document : The string "--" is not permitted within comments. Nested exception: The string "--" is not permitted within comments.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
... 4 more 展开
下面是全部的报错代码:
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at base.Test.add(Test.java:92)
at base.Test.main(Test.java:20)
Caused by: org.dom4j.DocumentException: Error on line 42 of document : The string "--" is not permitted within comments. Nested exception: The string "--" is not permitted within comments.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
... 4 more 展开
1个回答
2015-01-28
展开全部
注释里面不能用 "--"
你查下/hibernate.cfg.xml, 看看是不是哪个注释里面用了 "--"
你查下/hibernate.cfg.xml, 看看是不是哪个注释里面用了 "--"
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询