当我跟随restful project in netbeans时,我得到了错误。
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。我无法弄清楚这个问题。问题出在哪儿?我该如何解决这个问题?
答案 0 :(得分:1)
这只不过是一个简单的CLASSPATH问题。您的CLASSPATH中没有TopLink JAR。 NetBeans假设TopLink是您的JPA实现。
找到JAR并将它们提供给NetBeans或切换到Hibernate作为JPA实现。