Error message: Exception in thread “main” org.hibernate.HibernateException: Error accessing stax stream

前端 未结 3 705
渐次进展
渐次进展 2021-01-20 05:38

I´m trying to create a MySQL database table by using hibernate but I get this error message:

Exception in thread \"main\" org.hibernate.HibernateException: E         


        
相关标签:
3条回答
  • 2021-01-20 06:21

    You need to close the tag <hibernate-configuration.

    <hibernate-configuration>

    There is not the ! character in the DOCTYPE:

    <DOCTYPE hibernate-configuration PUBLIC
            "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
            "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
    

    Should be

    <!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
    
    0 讨论(0)
  • 2021-01-20 06:22

    I faced the same issue. It turns out that system is not able to access the hibernate-configuration-3.0.dtd from the url provided.

        <DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
    

    So, I referenced it from the local system.

        <!DOCTYPE hibernate-configuration SYSTEM
        "classpath://org/hibernate/hibernate-configuration-3.0.dtd">
    

    Worked well for me. Hope it helps!

    0 讨论(0)
  • 2021-01-20 06:24

    cleared the space at the begining of hibernate.cfg.xml file. lt worked

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

    0 讨论(0)
提交回复
热议问题