-->
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: Hibernate cfg xml configuration with Eclipse Europa ide
PostPosted: Sun Nov 15, 2009 7:33 am 
Newbie

Joined: Sun Nov 15, 2009 7:26 am
Posts: 2
I have Eclipse Europa and am trying to do a hibernate example in it.
I am trying to simply add an entry to the database.

My hibernate.cfg.xml file is as follows:
Code:
<?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="hibernate.connection.driver_class">org.derby.Driver</property>   
   <property name="hibernate.connection.url">jdbc:derby://localhost:1527/myDB</property>   
   <property name="hibernate.connection.username">me</property>   
   <property name="hibernate.connection.password">mine</property>   
   <property name="hibernate.connection.pool_size">10</property>   
   <property name="show_sql">true</property>   
   <property name="dialect">org.hibernate.dialect.DerbyDialect</property>   
   <property name="hibernate.hbm2ddl.auto">update</property>   
   <mapping resource="Job.hbm.xml"/>   
  </session-factory>   
   
</hibernate-configuration>


Eclipse keeps showing errors for this xml.

An when I run the class with the hibernate code it shows/throws the following error.

Code:
Nov 15, 2009 12:24:58 AM org.slf4j.impl.JCLLoggerAdapter info   
INFO: Hibernate 3.3.0.CR1   
Nov 15, 2009 12:24:59 AM org.slf4j.impl.JCLLoggerAdapter info   
INFO: hibernate.properties not found   
Nov 15, 2009 12:24:59 AM org.slf4j.impl.JCLLoggerAdapter info   
INFO: Bytecode provider name : cglib   
Nov 15, 2009 12:24:59 AM org.slf4j.impl.JCLLoggerAdapter info   
INFO: using JDK 1.4 java.sql.Timestamp handling   
Nov 15, 2009 12:25:00 AM org.slf4j.impl.JCLLoggerAdapter info   
INFO: configuring from resource: /hibernate.cfg.xml   
Nov 15, 2009 12:25:00 AM org.slf4j.impl.JCLLoggerAdapter info   
INFO: Configuration resource: /hibernate.cfg.xml   
Nov 15, 2009 12:25:00 AM org.slf4j.impl.JCLLoggerAdapter error   
[b]SEVERE: Error parsing XML: /hibernate.cfg.xml(2) The markup in the document preceding the root element must be well-formed.   
org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml   
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1505)   
at org.hibernate.cfg.Configuration.configure(Configuration.java:1439)   
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)   
at AddJob.main(AddJob.java:19)   
Caused by: org.dom4j.DocumentException: Error on line 2 of document  : The markup in the document preceding the root element must be well-formed. Nested exception: The markup in the document preceding the root element must be well-formed.   
at org.dom4j.io.SAXReader.read(SAXReader.java:482)   
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1495)[/b] ... 3 more   
Exception in thread "main" java.lang.NullPointerException   
at AddJob.main(AddJob.java:34) 


How do I get this resolved.

My java classes have no package hierarchy.
Is this problem due to Eclipse or is there an error in the xml.

_________________
-- Priety.


Top
 Profile  
 
 Post subject: Re: Hibernate cfg xml configuration with Eclipse Europa ide
PostPosted: Mon Nov 16, 2009 10:46 am 
Newbie

Joined: Sun Nov 15, 2009 7:26 am
Posts: 2
Hi,

The probelm is solved.
One question here.
Does anybody read the posts.

_________________
-- Priety.


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.