在GWT应用程序中找不到持久性提供程序异常

时间:2011-10-21 13:22:43

标签: java gwt persistence

嘿我得到一个持久性提供未找到异常我的persistence.xml的代码是

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="GWTSales"
    transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.jeroennouws.sales.beans.Branch</class>
    <class>com.jeroennouws.sales.beans.Customer</class>
    <class>com.jeroennouws.sales.beans.Employee</class>
    <class>com.jeroennouws.sales.beans.Product</class>
    <class>com.jeroennouws.sales.beans.Purchase</class>
    <class>com.jeroennouws.sales.beans.PurchaseDetail</class>
    <class>com.jeroennouws.sales.beans.PurchaseDetailPK</class>
    <class>com.jeroennouws.sales.beans.Sale</class>
    <class>com.jeroennouws.sales.beans.SalesDesk</class>
    <class>com.jeroennouws.sales.beans.SalesDetail</class>
    <class>com.jeroennouws.sales.beans.SalesDetailPK</class>
    <class>com.jeroennouws.sales.beans.Stock</class>
    <class>com.jeroennouws.sales.beans.Supplier</class>
    <class>com.jeroennouws.sales.beans.User</class>
    <properties>
        <property name="eclipselink.jdbc.password" value="" />
        <property name="eclipselink.jdbc.user" value="root" />
        <property name="eclipselink.jdbc.driver" value="com.mysql.jdbc.Driver" />
        <property name="eclipselink.jdbc.url" value="jdbc:mysql://localhost:3306/sales" />
        <property name="eclipselink.logging.level" value="INFO" />
    </properties>
</persistence-unit>
</persistence>

并且生成此异常的代码是

 public BranchJpaController() {
    emf = Persistence.createEntityManagerFactory("GWTSales");
}

到目前为止,我已尝试过所有不同类型的东西,eclipselink jar文件位于我的WEB-INF / lib文件夹中,而我的persistence.xml文件位于我的src / META-INF文件夹中。 这是否与eclipse插件中的GWT Jetty服务器有关,还是我遗漏了什么?

1 个答案:

答案 0 :(得分:0)

检查MySQL JDBC驱动程序是否在WEB-INF / lib文件夹中。

我希望它有所帮助。