我已经使用 Netbeans 在 Java 中的 OSX 中创建了一个项目,并与使用 github 在 Windows 上工作的同事一起工作。一旦他们克隆了项目,就会出现以下错误,这表明它无法使用 eclipse 连接到 derby 数据库。Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named MovieDatabasePU at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54) at moviedatabase.MovieDatabase.deleteFromDB(MovieDatabase.java:126) at moviedatabase.MovieDatabase.main(MovieDatabase.java:48)C:\Users\Mixalis\Documents\NetBeansProjects\Homework3\Ergasia3\nbproject\build-impl.xml:1076: The following error occurred while executing this line:C:\Users\Mixalis\Documents\NetBeansProjects\Homework3\Ergasia3\nbproject\build-impl.xml:830: Java returned: 1BUILD FAILED (total time: 2 seconds)我检查了 Stack 上描述的所有类似问题,但 persistence.xml 是正确的,它位于 src/META-INF 文件夹中的 META-INF 文件夹中。下面是持久化文件结构。<?xml version="1.0" encoding="UTF-8"?><persistence version="2.1" 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"> <persistence-unit name="MovieDatabasePU" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <class>moviedatabase.entities.FavoriteList</class> <class>moviedatabase.entities.Genre</class> <class>moviedatabase.entities.Movie</class> <properties> <property name="javax.persistence.jdbc.url" value="jdbc:derby://localhost:1527/person"/> <property name="javax.persistence.jdbc.user" value="pli24"/> <property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.ClientDriver"/> <property name="javax.persistence.jdbc.password" value="pli24"/> </properties> </persistence-unit></persistence>
添加回答
举报
0/150
提交
取消