0

当我在 netbeans 中关注 restful 项目时,我得到了错误。

SEVERE: Exception while invoking class org.glassfish.persistence.jpa.JPADeployer prepare method
java.lang.RuntimeException: java.lang.ClassNotFoundException: oracle.toplink.essentials.PersistenceProvider
Caused by: java.lang.ClassNotFoundException: oracle.toplink.essentials.PersistenceProvider

SEVERE: Exception while deploying the app
java.lang.RuntimeException: java.lang.ClassNotFoundException: oracle.toplink.essentials.PersistenceProvider
Caused by: java.lang.ClassNotFoundException: oracle.toplink.essentials.PersistenceProvider

我确信问题出在persistence.xml 中。那是我的persistence.xml :)

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="ayniPU" transaction-type="JTA">
    <provider>oracle.toplink.essentials.PersistenceProvider</provider>
    <jta-data-source>jndi/ayni</jta-data-source>
    <properties>
      <property name="toplink.ddl-generation" value="drop-and-create-tables"/>
       <property name="toplink.jdbc.user" value="root"/>
    <property name="toplink.jdbc.password" value="3774634"/>
    </properties>
  </persistence-unit>
</persistence>

我使用toplink 连接mysql 数据库。我有 glassfishv3 和 Netbeans6.7。我无法弄清楚问题所在。哪里有问题?我怎样才能解决这个问题?

4

1 回答 1

1

这只不过是一个简单的 CLASSPATH 问题。您的 CLASSPATH 中没有 TopLink JAR。NetBeans 假设 TopLink 是您的 JPA 实现。

找到 JAR 并将它们提供给 NetBeans 或切换到 Hibernate 作为您的 JPA 实现。

于 2009-09-08T09:20:28.047 回答