• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

hibernate error: Could not parse configuration: hibernate.cfg.xml

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I am a beginner in hibernate and I am trying to write my first application but I am getting an error saying "Could not parse configuration: hibernate.cfg.xml" and I have been try to resolve this from last 2 days but with no success

Can anyone please help me in resolving this issue. Thanks in advance

my hibernate.cfg.xml file

<?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.hbm2ddl.auto">update</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="connection.url">jdbc:sqlserver://isvdbd3:1119</property>
<property name="connection.username">digite</property>
<property name="connection.password">marksession</property>
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="current_session_context_class">thread</property>
<mapping resource="employee.hbm.xml"/>
</session-factory>

</hibernate-configuration>

I am using MS sql as my database


Error stack trace is as below

Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
at com.javatpoint.mypackage.StoreData.main(StoreData.java:13)
Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481)
... 2 more

Someone please let know

Regards,
Deepak
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Nn wrote:Hi Everyone,

I am a beginner in hibernate and I am trying to write my first application but I am getting an error saying "Could not parse configuration: hibernate.cfg.xml" and I have been try to resolve this from last 2 days but with no success

Can anyone please help me in resolving this issue. Thanks in advance

my hibernate.cfg.xml file

<?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.hbm2ddl.auto">update</property>
<property name="dialect">org.hibernate.dialect.DerbyDialect</property>
<property name="connection.url">jdbc:sqlserver://isvdbd3:1119</property>
<property name="connection.username">digite</property>
<property name="connection.password">marksession</property>
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="current_session_context_class">thread</property>
<mapping resource="employee.hbm.xml"/>
</session-factory>

</hibernate-configuration>

I am using MS sql as my database


Error stack trace is as below

Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1425)
at com.javatpoint.mypackage.StoreData.main(StoreData.java:13)
Caused by: org.dom4j.DocumentException: hibernate.sourceforge.net Nested exception: hibernate.sourceforge.net
at org.dom4j.io.SAXReader.read(SAXReader.java:484)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481)
... 2 more

Someone please let know

Regards,
Deepak


Ankurjadiya wrote: hi deepak
can you check your dialect for my sql database dialect is different you are using Derby Dialect instead of SQLServerDialect you can try this

 
Deepak Nn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks ankur

That was the problem plus there were some Jar files missing in the project. However I never got a proper error message for that

Is there any way to know what all jars are required in order to run a hibernate project
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic