"终止-6ren"> "终止-我是初学者,正在尝试运行第一个简单的代码。 请帮我解决以下问题。 Error on line 11 of document : The element type "session-factory" -6ren">
gpt4 book ai didi

java - 无法解析配置 : hibernate. cfg.xml:元素类型 "session-factory"必须由匹配的结束标记 ""终止

转载 作者:行者123 更新时间:2023-12-01 10:05:38 28 4
gpt4 key购买 nike

我是初学者,正在尝试运行第一个简单的代码。

请帮我解决以下问题。

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)

配置文件

<?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>

最佳答案

您需要关闭标签<session-factory>

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

关于java - 无法解析配置 : hibernate. cfg.xml:元素类型 "session-factory"必须由匹配的结束标记 "</session-factory>"终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36495470/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com