Java XML解析错误-Hibernate

Java XML解析错误-Hibernate,java,mysql,xml,hibernate,Java,Mysql,Xml,Hibernate,我正在尝试运行我的第一个Hibernate程序。 我无法找出问题所在,因为匹配的结束标记实际上在那里? 提前谢谢你的帮助 Error parsing XML: /hibernate.cfg.xml(11) The element type "session-factory" must be terminated by the matching end-tag hibernate.cfg.xml: <?xml version='1.0' encoding='UTF-8'?> <

我正在尝试运行我的第一个Hibernate程序。 我无法找出问题所在,因为匹配的结束标记实际上在那里? 提前谢谢你的帮助

Error parsing XML: /hibernate.cfg.xml(11) The element type "session-factory" must be terminated by the matching end-tag
hibernate.cfg.xml:

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

        <!-- Database connection settings -->
        <property name="hibernate.connection.driver_class" /> com.mysql.jdbc.Driver </property>
        <property name="hibernate.connection.url"/>jdbc:mysql://localhost:3306/westbahn</property>
        <property name="hibernate.connection.username" />root</property>
        <property name="hibernate.connection.password" />secretpassword</property>
        <property name="hibernate.dialect" />org.hibernate.dialect.MySQLInnoDBDialect</property>




        <property name="connection.pool_size">1</property>

        <property name="hibernate.dialect"> org.hibernate.dialect.MySQLInnoDBDialect" </property>

        <property name="show_sql">true</property>

        <property name="current_session_context_class">thread</property>
        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

        <property name="hibernate.hbm2ddl.auto">create</property>

    </session-factory>
</hibernate-configuration>

com.mysql.jdbc.Driver
jdbc:mysql://localhost:3306/westbahn
根
秘密密码
org.hibernate.dialogue.mysqlinnodbdialogue
1.
org.hibernate.dialogue.mysqlinnodbdialogue“
真的
线
org.hibernate.transaction.jdbc事务工厂
创造

Hibernate配置文件应如下所示

    <hibernate-configuration>
    <session-factory>
    <property name="connection.driver_class">oracle.jdbc.OracleDriver</property>
    <property name="connection.url">jdbc:oracle:thin:@localhost:1521:xe</property>
    <property name="connection.user">xxx</property>
    <property name="connection.password">xxxx</property>
    <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
    <property name="show_sql">true</property>
        <property name="hibernate.hbm2ddl.auto">create</property>   
    <mapping resource="xxxx.hbm.xml"/>
     </session-factory>
</hibernate-configuration>

oracle.jdbc.OracleDriver
jdbc:oracle:thin:@localhost:1521:xe
xxx
xxxx
org.hibernate.dialogue.oracle9dialogue
真的
创造

这可能会帮助您解决问题!!

您的5个第一属性元素是错误的:您使用了自关闭元素,尽管它们有一个主体。例如:

<property name="hibernate.connection.driver_class" /> com.mysql.jdbc.Driver </property>
com.mysql.jdbc.Driver
应该是

<property name="hibernate.connection.driver_class"> com.mysql.jdbc.Driver </property>
                                  no slash here --^
com.mysql.jdbc.Driver
这里没有斜线--^

您的XML中没有根hibernate配置元素。也没有打开会话工厂元素。显示整个文件。从第一行到最后一行。您的“属性”标记为空:
。从第一个标记中删除
/
非常感谢,它正在工作,这是一个多么严重的错误啊这是。。