-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Errors and Exceptions happenned when I go according to Doc
PostPosted: Thu Jun 23, 2005 8:31 am 
Newbie

Joined: Thu Jun 23, 2005 6:57 am
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 23, 2005 8:38 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Because the processing instruction target matching "[xX][mM][lL]" is not allowed.


Top
 Profile  
 
 Post subject: thanks a lot!
PostPosted: Thu Jun 23, 2005 9:55 pm 
Newbie

Joined: Thu Jun 23, 2005 6:57 am
Posts: 2
christian wrote:
Because the processing instruction target matching "[xX][mM][lL]" is not allowed.


I really appreciate your timely help, thanks!

After googled the key words, I found :

"the processing instruction target matching "[xX][mM][lL]" is not allowed" is a common problem that means there are some white spaces before the XML declaration.

(from http://wiki.apache.org/cocoon/FAQs)

and that's what cause the problem I met. Now I get everything fine.

:)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.