当我运行项目时,它像这样抛出异常:
请求处理失败;嵌套的异常是javax.persistence.PersistenceException:名为“ LessonJPAPU”的EntityManager的持久性提供程序没有
我的persistence.xml是这样的:
<persistence-unit name="LessonJPAPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>com.javatpoint.beans.Emp</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/users"/>
<property name="javax.persistence.jdbc.user" value="postgres"/>
<property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver"/>
<property name="javax.persistence.jdbc.password" value=""/>
</properties>
</persistence-unit>
怎么了?
答案 0 :(得分:0)
确保您的persistence.xml位于src / main / resources / META-INF文件夹中,并且该文件夹未从类路径中排除。