javax.persistence.PersistenceException: Invalid persistence.xml

半城伤御伤魂 提交于 2019-12-01 11:29:10

Unless you didn't copy-paste the complete file, the closing tag is missing. Append

</persistence>

in your persistence.xml

EDIT

It seems that the JNDI name of your datasource is wrong. Usually it starts with : java:/

switch to

<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">

This error means the version of Hibernate that you're using doesn't support version="2.1" in persistence.xml. Change the version to 2.0 (and update the xsi:schemaLocation for clarity).

Don't set a provider value.

remove

<provider>org.hibernate.ejb.HibernatePersistence</provider> 

and try.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!