Ich erhalte die folgenden FehlerDas Dokumentwurzelelement "Persistenz" muss mit dem DOCTYPE-Stamm "null" übereinstimmen. für persistence.xml JPA
Document root element "persistence", must match DOCTYPE root "null"
Unterhalb die XML-Datei wird es verursacht.
<?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="my-persistence">
<description>Persistence Unit</description>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<mapping-file>WEB-INF/config/application-context.xml</mapping-file>
<!--<jar-file>packedEntity.jar</jar-file>-->
<class>domain.Applicant</class>
<class>testScrEntry</class>
<properties>
<property name="javax.persistence.jdbc.url" value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.user" value="user"/>
<property name="javax.persistence.jdbc.password" value="password"/>
</properties>
</persistence-unit>
</persistence>
Stacktrace
o.s.w.c.s.XmlWebApplicationContext WARN: Exception encountered during
context initialization - cancelling refresh attempt:
org.springframework.beans.factory.BeanDefinitionStoreException: Failed
to parse configuration class [configuration.JpaConfiguration]; nested
exception is java.util.InvalidPropertiesFormatException:
org.xml.sax.SAXParseException: Document root element "persistence", must
match DOCTYPE root "`null"
natürlich gegoogelt ich den Fehler und es sagt mir hinzuzufügen, was ich auch tat und es sah so aus:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE persistence PUBLIC xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="my-pu">
<description>Persistence Unit</description>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<!--<mapping-file>application-context.xml</mapping-file>-->
<!--<jar-file>packedEntity.jar</jar-file>-->
<class>domain.Applicant</class>
<class>applicant.testScrEntry</class>
<properties>
<property name="javax.persistence.jdbc.url" value="oracle.jdbc.OracleDriver"/>
<property name="javax.persistence.jdbc.user" value="user"/>
<property name="javax.persistence.jdbc.password" value="password"/>
</properties>
</persistence-unit>
</persistence>
jedoch auch die oben nicht sagen, die Datei muss in der Nähe von >
sein. Es bezieht sich auf die rote ~ Linie neben </persistence>
.
The public identifier must begin with either a single or double quote character.
--------------------- UPDATE 1 ------------------ ------------
ich habe dies versucht:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE persistence PUBLIC
"http://xmlns.jcp.org/xml/ns/persistence"
"http://www.w3.org/2001/XMLSchema-instance"
"http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1">
Fehler: org.xml.sax.SAXParseException:The public identifier must begin with either a single or double quote character.
und
<?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">
ERROR: Document root element "persistence", must match DOCTYPE root "null".
und
<?xml version="1.0" encoding="UTF-8" ?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
Document Root-Element "Persistenz", muss DOCTYPE root "null" entsprechen.
XML-Schema ist falsch. Sehen Sie sich http://www.datanucleus.org/products/accessplatform_5_0/jpa/emf.html#Persistence_Unit an. –
@NeilStockton Ich schaute es an und es war nicht, den Compiler zu beschweren, aber es gibt mir immer noch den gleichen Fehler . – Drew1208