hibernate帮助文档上的第一个示例小程序
运行时出错:
2011-1-27 11:05:13 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource : Event.hbm.xml
2011-1-27 11:05:13 org.hibernate.util.XMLHelper$ErrorLogger error
严重: Error parsing XML: XML InputStream(8) An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1f".
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource Event.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at HibernateUtil.<clinit>(HibernateUtil.java:13)
at EventManager.createAndStoreEvent(EventManager.java:23)
at EventManager.main(EventManager.java:11)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource Event.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at HibernateUtil.<clinit>(HibernateUtil.java:9)
... 2 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
... 9 more
Caused by: org.dom4j.DocumentException: Error on line 8 of document : An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1f". Nested exception: An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1f".
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
... 10 more
Java Result: 1看提示好象是映射文件Event.hbm.xml中的字符问题,可是没找到非法字符,贴出来看看:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Event" table="events">
<id name="id" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>
</hibernate-mapping>请问是哪里的问题呢
运行时出错:
2011-1-27 11:05:13 org.hibernate.cfg.Configuration addResource
信息: Reading mappings from resource : Event.hbm.xml
2011-1-27 11:05:13 org.hibernate.util.XMLHelper$ErrorLogger error
严重: Error parsing XML: XML InputStream(8) An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1f".
Initial SessionFactory creation failed.org.hibernate.InvalidMappingException: Could not parse mapping document from resource Event.hbm.xml
Exception in thread "main" java.lang.ExceptionInInitializerError
at HibernateUtil.<clinit>(HibernateUtil.java:13)
at EventManager.createAndStoreEvent(EventManager.java:23)
at EventManager.main(EventManager.java:11)
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource Event.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:569)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1587)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1555)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1534)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1508)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1428)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1414)
at HibernateUtil.<clinit>(HibernateUtil.java:9)
... 2 more
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:508)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:566)
... 9 more
Caused by: org.dom4j.DocumentException: Error on line 8 of document : An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1f". Nested exception: An invalid XML character (Unicode: 0x{2}) was found in the value of attribute "{1}" and element is "1f".
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:499)
... 10 more
Java Result: 1看提示好象是映射文件Event.hbm.xml中的字符问题,可是没找到非法字符,贴出来看看:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Event" table="events">
<id name="id" column="EVENT_ID">
<generator class="increment"/>
</id>
<property name="date" type="timestamp" column="EVENT_DATE"/>
<property name="title"/>
</class>
</hibernate-mapping>请问是哪里的问题呢
解决方案 »
- J2EE的框架下,何种UI开发技术更合适?
- Map resultMap = new HashMap();
- 关于struts2
- 从xml中取值的问题。
- struts2.1中的Socket问题
- No result defined for action
- 初学关于javabean路径的问题(在线等待)
- 百思不得其解,请求高手指点:在IE中显示树形结构数据的算法和代码。
- 帮助我系统的致命点:我开发了一套“文件管理系统”,(jsp语言,resin服务器)但
- 请教:weblogic 6.0下如何设置数据库连接池?如何连接数据库?谢谢!(详细一点)
- jsp Servlet 中如何写下载代码 下载100M左右的压缩文件
- jsp的超链接的写法
建议你去拷贝下User.hbm.xml 然后进行修改
用hibernate重新生成一个 然后比较下