File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Deepak Nn
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
ankur jadiya
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic