hi, as a newbie I am learning "Hibernate Reference Documentation", and do everything under the instruction of it. Problems occured when I read "Chapter 2. Introduction to Hibernate".
my utilities:
Code:
win2000 professional
jdk1.5
hibernate3.0
ant1.6.2
HSQLDB 1.7.2
appbase tree view :
Code:
appbase
│ build.xml
│
│
├─src
│ Event.java
│ Cat.hbm.xml
│ hibernate.cfg.xml
│ HibernateUtil.java
│ log4j.properties
│ EventManager.java
│ Event.hbm.xml
│
├─lib
│ hsqldb.jar
│ jta.jar
│ asm.jar
│ asm-attrs.jar
│ cglib-2.1.jar
│ commons-collections-2.1.1.jar
│ commons-logging-1.0.4.jar
│ dom4j-1.6.jar
│ ehcache-1.1.jar
│ antlr-2.7.5H3.jar
│ log4j-1.2.9.jar
│ hibernate3.jar
│
├─data
└─bin
Cat.hbm.xml
log4j.properties
hibernate.cfg.xml
Event.hbm.xml
everything went fine util I reach the part "2.2.6. Loading and storing objects", when I input command :
Code:
%appbase%\ant run -Daction=store
instead of the expected out put, I got Errors and Exceptions:
Code:
Buildfile: build.xml
clean:
[delete] Deleting directory E:\kyle\myApp\hibernate\start\bin
[mkdir] Created dir: E:\kyle\myApp\hibernate\start\bin
copy-resources:
[copy] Copying 4 files to E:\kyle\myApp\hibernate\start\bin
compile:
[javac] Compiling 3 source files to E:\kyle\myApp\hibernate\start\bin
[javac] Note: E:\kyle\myApp\hibernate\start\src\HibernateUtil.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
run:
[java] 19:32:04,861 INFO Environment:464 - Hibernate 3.0.5
[java] 19:32:04,951 INFO Environment:477 - hibernate.properties not found
[java] 19:32:05,212 INFO Environment:510 - using CGLIB reflection optimizer
[java] 19:32:05,272 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
[java] 19:32:06,053 INFO Configuration:1110 - configuring from resource: /hibernate.cfg.xml
[java] 19:32:06,063 INFO Configuration:1081 - Configuration resource: /hibernate.cfg.xml
[java] 19:32:10,289 INFO Configuration:444 - Mapping resource: Event.hbm.xml
[java] 19:32:10,409 ERROR XMLHelper:59 - Error parsing XML: XML InputStream(2) The processing instruction target matching "[xX][mM][lL]" is not allowed.
[java] 19:32:10,449 ERROR Configuration:407 - Could not configure datastore from input stream
[java] org.dom4j.DocumentException: Error on line 2 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[java] at org.dom4j.io.SAXReader.read(SAXReader.java:482)
[java] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398)
[java] at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
[java] at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
[java] at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)
[java] Nested exception:
[java] org.xml.sax.SAXParseException: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[java] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1269)
[java] at org.dom4j.io.SAXReader.read(SAXReader.java:465)
[java] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398)
[java] at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
[java] at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
[java] at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)
[java] Initial SessionFactory creation failed.org.hibernate.MappingException: Error reading resource: Event.hbm.xml
[java] Exception in thread "main" java.lang.ExceptionInInitializerError
[java] at HibernateUtil.<clinit>(Unknown Source)
[java] at EventManager.createAndStoreEvent(Unknown Source)
[java] at EventManager.main(Unknown Source)
[java] Caused by: org.hibernate.MappingException: Error reading resource: Event.hbm.xml
[java] at org.hibernate.cfg.Configuration.addResource(Configuration.java:452)
[java] at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1263)
[java] at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1235)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1217)
[java] at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1184)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1112)
[java] at org.hibernate.cfg.Configuration.configure(Configuration.java:1098)
[java] ... 3 more
[java] Caused by: org.hibernate.MappingException: org.dom4j.DocumentException: Error on line 2 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[java] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:408)
[java] at org.hibernate.cfg.Configuration.addResource(Configuration.java:449)
[java] ... 9 more
[java] Caused by: org.dom4j.DocumentException: Error on line 2 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed.
[java] at org.dom4j.io.SAXReader.read(SAXReader.java:482)
[java] at org.hibernate.cfg.Configuration.addInputStream(Configuration.java:398)
[java] ... 10 more
BUILD SUCCESSFUL
Total time: 31 seconds
so why?
Any reply would be appriecated.