hibernate之无法解析hibernate.cfg.xml
来源:互联网 发布:ios安卓数据互通的游戏 编辑:程序博客网 时间:2024/05/17 03:40
刚开始学习hibernate,在写完java对象、配置hibernate相关xml后,通过客户端调用时,程序报出以下异常:
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2013) at org.hibernate.cfg.Configuration.configure(Configuration.java:1925) at org.hibernate.cfg.Configuration.configure(Configuration.java:1904) at com.lvaj.examples.example1.Client.main(Client.java:10)Caused by: org.dom4j.DocumentException: Error on line 4 of document : The system identifier must begin with either a single or double quote character. Nested exception: The system identifier must begin with either a single or double quote character. at org.dom4j.io.SAXReader.read(SAXReader.java:482) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2005) ... 3 more
根据异常内容在hibernate.cfg.xml文件排查,最后发现原来是犯了一个低级错误,即hibernate.cfg.xml文件的头部分漏写了。原内容(错误内容)为:
<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
正确的头内容为:
<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD 3.0//EN""http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
果然是细节决定成败啊!
- hibernate之无法解析hibernate.cfg.xml
- ssh框架 之 hibernate 之 hibernate.cfg.xml配置解析
- Hibernate.cfg.xml配置文件解析
- Hibernate: hibernate.cfg.xml 的解析
- hibernate 配置文件之hibernate.cfg.xml说明
- Hibernate连接Oracle10g之hibernate.cfg.xml
- Hibernate学习之hibernate.cfg.xml
- hibernate之hibernate.cfg.xml详解
- hibernate 配置文件之hibernate.cfg.xml说明
- Hibernate配置文件之hibernate.cfg.xml
- Hibernate学习之配置文件hibernate.cfg.xml
- Hibernate.cfg.xml配置文件模板及解析
- Hibernate.cfg.xml配置文件模板及解析
- 自己解析hibernate.cfg.xml 的问题
- Hibernate源码解析---------hibernate.cfg.xml读取流程
- Hibernate配置文件创建及解析,hibernate.cfg.xml----Hibernate_0
- hibernate 读取hibernate.cfg.xml
- hibernate配置文件hibernate.cfg.xml
- ClassWizard里面找不到WM_ACTIVATE消息解决
- 1721. Gray code
- 黑马程序员-学习-正则表达式
- C++ How To Program专业词汇Ch02
- *printf()格式化串安全漏洞分析(上)
- hibernate之无法解析hibernate.cfg.xml
- ubuntu从命令行启动的方法
- c语言 知识总结
- 今天各种坑 库连不上,apache装起来外面访问不了,fsockopen 权限不够
- [Frame(extraClass="XXXXXX")] 标签
- LUA与C++交互第一篇
- firebird
- Unity3d iTween Path Editor C#版不仅可让C#开发者使用,也可为JS开发者使用
- Hadoop入门系列1—— 安装,配置,编程,部署和运行