Java OpenJPA-ArgumentException:JDBC驱动程序或数据源类名

Java OpenJPA-ArgumentException:JDBC驱动程序或数据源类名,java,tomcat,netbeans,openjpa,Java,Tomcat,Netbeans,Openjpa,我正在用maven创建一个OpenJPA应用程序。 应用程序将启动,但如果我尝试访问数据库实体,则会出现以下异常: HTTP Status 500 - <openjpa-2.2.2-r422266:1468616 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persi

我正在用maven创建一个OpenJPA应用程序。 应用程序将启动,但如果我尝试访问数据库实体,则会出现以下异常:

HTTP Status 500 - <openjpa-2.2.2-r422266:1468616 fatal user error> org.apache.openjpa.persistence.ArgumentException: The persistence provider is attempting to use properties in the persistence.xml file to resolve the data source. A Java Database onnectivity (JDBC) driver or data source class name must be specified in the openjpa.ConnectionDriverName or javax.persistence.jdbc.driver property. The following properties are available in the configuration: "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@442ce698".
HTTP Status 500-org.apache.openjpa.persistence.ArgumentException:持久性提供程序正在尝试使用persistence.xml文件中的属性解析数据源。必须在openjpa.ConnectionDriverName或javax.persistence.JDBC.driver属性中指定Java数据库连接(JDBC)驱动程序或数据源类名。以下属性在配置中可用:“org.apache.openjpa.jdbc.conf。JDBCConfigurationImpl@442ce698".
persistence.xml位于META-INF中,由Netbeans 8控制。 ConnectionDriverName设置如下:

<property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>

我的src\main\java\META-INF\persistence.xml(类标记减少,数据库设置更改):


org.apache.openjpa.persistence.PersistenceProviderImpl
com.example.test.my.entities.User
真的

我使用的是Tomcat 8(Tomcat 7或Tomee的结果相同)。

通过切换到eclipse解决了这个问题,因为netbeans似乎在persistence.xml方面存在一些问题。 在eclipse中,我必须使用以下m2e连接器:
(eclipse软件存储库url)

编辑问题并添加persistence.xml文件。完成。:)提前感谢发布完整的堆栈跟踪。
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">
  <persistence-unit name="PersistenceUnit" transaction-type="RESOURCE_LOCAL">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <class>com.example.test.my.entities.User</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
      <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
      <property name="openjpa.Log" value="DefaultLevel=INFO, Tool=INFO, SQL=TRACE"/>
      <property name="openjpa.jdbc.DBDictionary" value="org.apache.openjpa.jdbc.sql.MySQLDictionary"/>
      <property name="openjpa.ConnectionDriverName" value="org.apache.commons.dbcp.BasicDataSource"/>
      <property name="openjpa.ConnectionFactoryProperties" value="PrettyPrint=true, PrettyPrintLineLength=80, PrintParameters=true"/>
      <property name="openjpa.ConnectionProperties" value="DriverClassName=com.mysql.jdbc.Driver,
             Url=jdbc:mysql://localhost:3306/database?autoReconnect=true,
             Username=usr,
             Password=pwd,
             MaxWait=60000,
             TestOnBorrow=true,
             validationQuery=select 1"/>
    </properties>
  </persistence-unit>
</persistence>