Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
EntityManager Tomcat 7没有持久性提供程序_Tomcat_Jpa_Eclipselink - Fatal编程技术网

EntityManager Tomcat 7没有持久性提供程序

EntityManager Tomcat 7没有持久性提供程序,tomcat,jpa,eclipselink,Tomcat,Jpa,Eclipselink,我正在将我的web应用从Glassfish 4迁移到Tomcat 7。当我尝试运行它时,我得到以下错误:PersistenceException:EntityManager没有持久性提供程序。我的应用程序使用EclipseLink 我以这种方式修改了persistence.xml: <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/n

我正在将我的web应用从Glassfish 4迁移到Tomcat 7。当我尝试运行它时,我得到以下错误:PersistenceException:EntityManager没有持久性提供程序。我的应用程序使用EclipseLink

我以这种方式修改了persistence.xml:

<?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="com.cisco_OnePK_Web_war_1.0PU" transaction-type="RESOURCE_LOCAL">


    <properties>
      <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
      <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/one_pk" />
      <property name="javax.persistence.jdbc.user" value="alex"/>
      <property name="javax.persistence.jdbc.password" value="alex21"/>
      <property name="eclipselink.logging.level" value="FINE"/>
      <property name="eclipselink.ddl-generation.output-mode" value="datab"/>
      <property name="eclipselink.ddl-generation" value="create-tables"/>
    </properties>
  </persistence-unit>
</persistence>

以下是my context.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/oneweb">
<Resource name="jdbc/one_pk" auth="Container"
          type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
          url="jdbc:postgresql://localhost:5432/one_pk"
          username="alex" password="alex21" maxActive="20" maxIdle="30"
maxWait="-1"/>
</Context>

和web.xml:

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee                       http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

<resource-ref>
 <description>postgreSQL Datasource example</description>
 <res-ref-name>jdbc/one_pk</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

</web-app>

postgreSQL数据源示例
jdbc/one_pk
javax.sql.DataSource
容器

尝试在持久性单元下添加信息。比如org.eclipse.persistence.jpa.persistenceProvider类路径上有EclipseLink吗?