Installing my web application to WebSphere Application Server 8 fails due to a syntax error in my persistence.xml. According to my IDE, there is no error. What is the actual problem?
persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" version="2.1"
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_1.xsd"
>
<persistence-unit name="myapp">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
</persistence-unit>
</persistence>
Excerpts from stack trace (SystemOut.log):
1:
Caused by: com.ibm.ws.metadata.MetaDataException: CWWJP0040E: The persistence.xml in application PA_Appl, module Appl-0.1.war, has a syntax error at line number: 6, column number: 2.
2:
Caused by: org.xml.sax.SAXParseException: expected root element {http://java.sun.com/xml/ns/persistence}persistence
Please comment, if you need more information.
Try this
<?xml version="1.0" ?>
<persistence 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"
version="2.0">
<persistence-unit name="myapp">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
</persistence-unit>
</persistence>