hibernate运行时报的错误,求解

Y_Snowfree 2012-07-13 01:17:22
错误信息如下:
20:03:39,249 INFO Version:15 - Hibernate Annotations 3.4.0.GA
20:03:39,272 INFO Environment:560 - Hibernate 3.3.2.GA
20:03:39,275 INFO Environment:593 - hibernate.properties not found
20:03:39,283 INFO Environment:771 - Bytecode provider name : javassist
20:03:39,288 INFO Environment:652 - using JDK 1.4 java.sql.Timestamp handling
20:03:39,390 INFO Version:14 - Hibernate Commons Annotations 3.1.0.GA
20:03:39,393 INFO Configuration:1474 - configuring from resource: /hibernate.cfg.xml
20:03:39,394 INFO Configuration:1451 - Configuration resource: /hibernate.cfg.xml
20:03:39,471 DEBUG DTDEntityResolver:64 - trying to resolve system-id [http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd]
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.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:1035)
at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:64)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1017)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:64)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:1011)
at org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:64)
at com.yxk.test.T.main(T.java:23)
Caused by: org.dom4j.DocumentException: www.hibernate.org Nested exception: www.hibernate.org
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
... 9 more
...全文
281 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Y_Snowfree 2012-07-15
  • 打赏
  • 举报
回复
在eclipse里面可以用,说明不是文件的结构问题。
----------------------------------------
Caused by: org.dom4j.DocumentException: www.hibernate.org Nested exception: www.hibernate.org
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1532)
... 9 more
----------------------------------------
上面这个是什么错误,你知道怎么解决么?
[Quote=引用 6 楼 的回复:]

Could not parse configuration: /hibernate.cfg.xml
不能解析 ,检查一下这个文件的结构是否正确
[/Quote]
狂想者 2012-07-15
  • 打赏
  • 举报
回复
jar版本的问题
Y_Snowfree 2012-07-14
  • 打赏
  • 举报
回复
同样的jar包,同样的配置文件,为什么我在eclipse上面运行没有问题,搬到myeclipse8上面就会报这个错误?[Quote=引用 2 楼 的回复:]

1.如果是无法读取的话,则会直接报错,cannot find.
2.can not parse cofiguration:是因为你的jar包和你写的配置xml不对应,所以无法解析。
可能有人就问了你怎么看我的Hibernate.jar的版本啊:
你新建一个hibernate1.cfg.xml,内容随便写,然后你在里面的
<!DOCTYPE hibernate-mappin……
[/Quote]
Y_Snowfree 2012-07-14
  • 打赏
  • 举报
回复
我也知道是不能解析,关键是为什么不能解析啊。。。[Quote=引用 1 楼 的回复:]

Could not parse configuration: /hibernate.cfg.xml

不能解析hibernate配置文件。。
[/Quote]
五哥 2012-07-14
  • 打赏
  • 举报
回复
Could not parse configuration: /hibernate.cfg.xml
不能解析 ,检查一下这个文件的结构是否正确
wuhuipengwhp 2012-07-13
  • 打赏
  • 举报
回复
1.如果是无法读取的话,则会直接报错,cannot find.
2.can not parse cofiguration:是因为你的jar包和你写的配置xml不对应,所以无法解析。
可能有人就问了你怎么看我的Hibernate.jar的版本啊:
你新建一个hibernate1.cfg.xml,内容随便写,然后你在里面的
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
上面的3.0就是版本号
3.解决问题
1.将hibernate.cfg.xml如上,版本该过来
2.将XXX.hbm.xml(映射表文件),版本也改过来
wuhuipengwhp 2012-07-13
  • 打赏
  • 举报
回复
1.如果是无法读取的话,则会直接报错,cannot find.
2.can not parse cofiguration:是因为你的jar包和你写的配置xml不对应,所以无法解析。
可能有人就问了你怎么看我的Hibernate.jar的版本啊:
你新建一个hibernate1.cfg.xml,内容随便写,然后你在里面的
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
上面的3.0就是版本号
3.解决问题
1.将hibernate.cfg.xml如上,版本该过来
2.将XXX.hbm.xml(映射表文件),版本也改过来
正派青年演员 2012-07-13
  • 打赏
  • 举报
回复
Could not parse configuration: /hibernate.cfg.xml

不能解析hibernate配置文件。。

67,512

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧