shaher
shaher

Reputation: 21

Could not parse configuration: hibernate.cfg.xml: The element type "session-factory" must be terminated by the matching end-tag "</session-factory>"

I am a beginner and trying to run first simple code.

Please help me resolve the following issue.

Error on line 11 of document  : The element type "session-factory" must be terminated by the matching end-tag "</session-factory>". 
Nested exception: The element type "session-factory" must be terminated by the matching end-tag "</session-factory>".
        at org.dom4j.io.SAXReader.read(SAXReader.java:482)

config file

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
 <session-factory>
        <property name="connection.driver_class">org.postgresql.Driver</property>
        <property name="connection.url">jdbc:postgresql://localhost:5432/hibernatedb</property>
        <property name="connection.username">postgres</property>
        <property name="connection.password"/>shaher</property>
        <property name="connection.pool_size">1</property>
        <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property>
        <property name="cache.provider_class">org.hibernate.cache.internal.NoCacheProvider</property>
        <property name="show_sql">true</property>
        <property name="hbm2ddl.auto">create</property>
        <mapping class="org.shaher.hiber.dto.UserDetails"/>
 </session-factory>
</hibernate-configuration>

Upvotes: 0

Views: 300

Answers (2)

user3127078
user3127078

Reputation: 1

you have problem with your config file see this <property name="connection.password"/>shaher</property>

please update it to below <property name="connection.password">shaher</property>

Upvotes: 0

v.ladynev
v.ladynev

Reputation: 19976

You need to close the tag <session-factory>

<session-factory>
  ...
</session-factory>

Upvotes: 1

Related Questions