0

このpersistence.xmlファイルを読み込もうとしています:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
             http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">
    <persistence-unit name="Eclipselink_JPA" transaction-type="RESOURCE_LOCAL">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <exclude-unlisted-classes>false</exclude-unlisted-classes>
        <properties>
            <property name="javax.persistence.jdbc.db" value="polldb"/>
            <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/polldb"/>
            <property name="javax.persistence.jdbc.user" value="root"/>
            <property name="javax.persistence.jdbc.password" value=""/>
            <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
            <property name="javax.persistence.schema-generation.database.action" value="create"/>
        </properties>
    </persistence-unit>
</persistence>

使用:

                Properties props = new Properties();
                props.loadFromXML(this.getClass().getResourceAsStream("/META-INF/persistence.xml"));

そして、このエラーを返しています: Caused by: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 28; Document root element "persistence", must match DOCTYPE root "null".

誰がそれが何であるか知っていますか?どうもありがとうございます!!

4

0 に答える 0