Soru & Cevap

Eclipsde hibernate kullanırken kod çalışlmıyor veritabanına erişmiyor ne yapmalıyım?

21.08.2020 - 02:45


Ağu 21, 2020 2:36:28 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {6.0.0.Alpha2}
Ağu 21, 2020 2:36:28 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Exception in thread "main" org.hibernate.HibernateException: Error accessing stax stream
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:107)
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:65)
at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:57)
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:165)
at org.hibernate.cfg.Configuration.configure(Configuration.java:265)
at com.elif.kitapdeneme2.Main.main(Main.java:12)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[5,2]
Message: The markup in the document preceding the root element must be well-formed.
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(Unknown Source)
at com.sun.xml.internal.stream.XMLEventReaderImpl.peek(Unknown Source)
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:103)
... 5 more

kodu çalıştırdıgımda bu hatayı alıyorum kodun hibernate.cfg.xml dosyası şöyle;

<?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>
<!DOCTYPE hibernate-configuration SYSTEM
    "classpath://org/hibernate/hibernate-configuration-3.0.dtd">
    <session-factory>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property
        <property name="hibernate.connection.driver.url">jdbc:mysql://localhost:3306/kitaplık?useSSL=false&amp;serverTimezone=UTC></property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.connection.password">12345</property>
        <property name="hibernate.connection.pool_size">1</property>
        <property name="hibernate.hbm2ddl.auto">update</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.show_sql">true</property>
     
        <mapping class="com.elif.kitapdeneme2.Kitap"/>
     </session-factory>
</hibernate-configuration>

nerde hata var ne yapmalıyım?

1 Görüntülenme

0 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.