The moose likes Object Relational Mapping and the fly likes getting Hibernate error: Could not parse configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "getting Hibernate error: Could not parse configuration" Watch "getting Hibernate error: Could not parse configuration" New topic

getting Hibernate error: Could not parse configuration

Sarvesh Pal

Joined: May 30, 2013
Posts: 1
My hibernate.cfg.xml is below and i am getting the errors which is below the cfg.xml

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration SYSTEM "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd" PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN">
<!-- Database connection settings -->
<property name="connection.driver_class">org.postgresql</property>
<property name="connection.url">jdbc:postgresql://localhost:5432/hibernatedb</property>
<property name="connection.username">postgres</property>
<property name="connection.password">password</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">create</property>

<!-- Names the annotated entity class -->
<mapping class="com.dto.UserDetails"/>



______________errors Below___________please HElp___________________ Please Help with Errors__________________________________________________________

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2246)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2158)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2137)
at com.hibernate.HibernateTest.main(HibernateTest.java:18)
Caused by: org.dom4j.DocumentException: Error on line 3 of document : The document type declaration for root element type "hibernate-configuration" must end with '>'. Nested exception: The document type declaration for root element type "hibernate-configuration" must end with '>'.
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2238)
... 3 more

Balaji Vankadaru
Ranch Hand

Joined: May 31, 2013
Posts: 47
Just try to update your sl4j jar. The current version which your have included is not supporting the cause. Just this change would allow your code to run like a champ.
subject: getting Hibernate error: Could not parse configuration
Similar Threads
Hibernate: schema export unsuccessful java.sql.SQLTransientConnectionException: java.net.ConnectExce
Consume web service in spring
org.hibernate.exception.JDBCConnectionException: Cannot open connection
Changing POJO class after Domain to Table creation using SchemaExport!
Hibernate beginner