-->
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.  [ 2 posts ] 
Author Message
 Post subject: Verbindung von Eclipse/Hibernate zu MySQL
PostPosted: Thu Jan 15, 2009 6:56 am 
Newbie

Joined: Thu Jan 15, 2009 6:27 am
Posts: 1
Hallo, ich nutze Hibernate+Eclipse zum ersten Mal. Habe mich nun an ein Tutorial gehalten und dies durchgearbeitet....

Leider bekomme ich noch keine Verbindung zu meiner Datenbank in MySQL. So lautet die Fehlermeldung:

Code:

log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
Inital erro
Exception in thread "main" java.lang.ExceptionInInitializerError
   at uk.co.planetjava.hibernate.bookstore.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:17)
   at uk.co.planetjava.hibernate.bookstore.Main.main(Main.java:11)
Caused by: org.hibernate.HibernateException: problem parsing configuration/hibernate.cfg.xml
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1291)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1230)
   at org.hibernate.cfg.Configuration.configure(Configuration.java:1216)
   at uk.co.planetjava.hibernate.bookstore.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:14)
   ... 1 more
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.
   at org.dom4j.io.SAXReader.read(SAXReader.java:482)
   at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1286)
   ... 4 more



Weiß hier vielleicht jemand, woher die Fehlermeldung kommt bzw. was ich machen kann, um die Fehler zu korrigieren??

Stimmt eventuell etwas mit meiner Mapping-Dateien nicht??

Code der Mapping-Datei für die Datei Book:

Code:

<?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 ="uk.co.planejava.hibernate.bookstore.Book" table="BOOKS">
   <id name="id" column="BOOK_ID">
      <generator class="increment"/>
      </id>
      <property name="title"/>
      <property name="author"/>
      <property name="price"/>
      </class>
</hibernate-mapping>



Code der allgemeinen Mapping-Datei im class-Path-Ordner:

Code:

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<property name="connection.username">hibuser</property>
<property name="connection.url">jdbc:mysql://localhost.hib</property>
<property name="dialect">org.hibernate.dialect.MySQLMyISAMDialect</property>
<property name="connection.password">hib123</property>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="show_sql">true</property>

<mapping resource="uk/co/planetjava/hibernate/bookstore/Book.hbm.xml"/>
</session-factory>
</hibernate-configuration>



Vielen Dank schonmal für Eure Antworten. Ich hoffe, Ihr könnt mir weiter helfen.

Buergy


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2009 3:42 am 
Newbie

Joined: Mon Jan 12, 2009 3:59 am
Posts: 6
hm, für mich sieht es so aus als wäre der header deiner hibernate.cfg.xml fehlerhaft.

Ich denke er hat ein Problem damit:

Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<?xml version='1.0' encoding='UTF-8'?>


Vielleicht funktionierts ja wenn du nur eine der beiden Zeilen nimmst.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.