[英]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>
You need to close the tag <session-factory>
您需要关闭标签
<session-factory>
<session-factory>
...
</session-factory>
you have problem with your config file see this <property name="connection.password"/>shaher</property>
您的配置文件有问题,请参见此
<property name="connection.password"/>shaher</property>
please update it to below <property name="connection.password">shaher</property>
请将其更新为
<property name="connection.password">shaher</property>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.