JPA在MySQL中使用JBoss-java.lang.ClassNotFoundException:org.hibernate.exception.GenericJDBCException

JPA在MySQL中使用JBoss-java.lang.ClassNotFoundException:org.hibernate.exception.GenericJDBCException,java,mysql,jpa,jboss,Java,Mysql,Jpa,Jboss,我有一个使用JBoss7.1和MySQL的简单EJB3项目。运行客户机时,我遇到以下异常:java.lang.ClassNotFoundException:org.hibernate.exception.GenericJDBCException。它在尝试持久化数据时发生。有人能帮我吗?我不熟悉EJB和J2EE。这是我的客户端属性文件: remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remo

我有一个使用JBoss7.1和MySQL的简单EJB3项目。运行客户机时,我遇到以下异常:java.lang.ClassNotFoundException:org.hibernate.exception.GenericJDBCException。它在尝试持久化数据时发生。有人能帮我吗?我不熟悉EJB和J2EE。这是我的客户端属性文件:

remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

remote.connections=default

remote.connection.default.host=localhost
remote.connection.default.port = 4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
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="JPADB">
    <jta-data-source>java:/MySQLDS</jta-data-source>
        <properties>
            <property name="showSql" value="true"/>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        </properties>
    </persistence-unit>
</persistence>
<datasource jndi-name="java:/MySQLDS"
    pool-name="MySQLDS" enabled="true" use-java-context="true">
    <connection-url>
        jdbc:mysql://localhost:3306/sample
    </connection-url>
    <driver>mysqlDriver</driver>
    <security>
        <user-name>YOUR-MYSQL-USERNAME</user-name>
        <password>YOUR-MYSQL-PASSWORD</password>
    </security>
</datasource>
<driver name="mysqlDriver" module="com.mysql">
    <xa-datasource-class>
        com.mysql.jdbc.Driver
    </xa-datasource-class>
</driver>
package com.ibytecode.client;

import java.util.List;

import javax.naming.Context;
import javax.naming.NamingException;

import com.ibytecode.business.IProject;
import com.ibytecode.businesslogic.ProjectBean;
import com.ibytecode.clientutility.JNDILookupClass;
import com.ibytecode.entities.Project;

public class EJBApplicationClient {

    public static void main(String[] args) {
        IProject bean = doLookup();

        Project p1 = new Project();
        p1.setPnumber(1);
        p1.setPname("Banking App");
        p1.setPlocation("Town City");
        p1.setDeptNo(1);

        Project p2 = new Project();
        p2.setPnumber(2);
        p2.setPname("Office Automation");
        p2.setPlocation("Downtown");
        p2.setDeptNo(2);

        // 4. Call business logic
        //Saving new Projects
        bean.saveProject(p1);
        bean.saveProject(p2);

        //Find a Project
        //p1.setPnumber(1);
        Project p3 = bean.findProject(p1);
        System.out.println(p3);

        //Retrieve all projects
       System.out.println("List of Projects:");
        List<Project> projects = bean.retrieveAllProjects();
        for(Project project : projects)
            System.out.println(project);


    }

    private static IProject doLookup() {
        Context context = null;
        IProject bean = null;
        try {
            // 1. Obtaining Context
            context = JNDILookupClass.getInitialContext();
            // 2. Generate JNDI Lookup name
            String lookupName = getLookupName();
            // 3. Lookup and cast
            bean = (IProject) context.lookup(lookupName);

        } catch (NamingException e) {
            e.printStackTrace();
        }
        return bean;
    }

    private static String getLookupName() {
        /*The app name is the EAR name of the deployed EJB without .ear 
        suffix. Since we haven't deployed the application as a .ear, the app 
        name for us will be an empty string */
        String appName = "";

        /* The module name is the JAR name of the deployed EJB without the 
        .jar suffix.*/
        String moduleName = "FirstJPAProject";

        /* AS7 allows each deployment to have an (optional) distinct name. 
        This can be an empty string if distinct name is not specified.*/
        String distinctName = "";

        // The EJB bean implementation class name
        String beanName = ProjectBean.class.getSimpleName();

        // Fully qualified remote interface name
        final String interfaceName = IProject.class.getName();

        // Create a look up string name
        String name = "ejb:" + appName + "/" + moduleName + "/" + 
                distinctName    + "/" + beanName + "!" + interfaceName;
        return name;
    }
}
package com.ibytecode.entities;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;

@Entity(name = "project")
public class Project implements Serializable {
    private static final long serialVersionUID = 1L;

    public Project() {
        super();
    }

    @Id
    private int pnumber;
    private String pname;
    private String plocation;

    @Column(name = "dept_no")
    private int deptNo;

    public int getPnumber() {
        return pnumber;
    }
    public void setPnumber(int pnumber) {
        this.pnumber = pnumber;
    }
    public String getPname() {
        return pname;
    }
    public void setPname(String pname) {
        this.pname = pname;
    }
    public String getPlocation() {
        return plocation;
    }
    public void setPlocation(String plocation) {
        this.plocation = plocation;
    }
    public int getDeptNo() {
        return deptNo;
    }
    public void setDeptNo(int deptNo) {
        this.deptNo = deptNo;
    }
    @Override
    public String toString() {
        return "Project [pnumber=" + pnumber + ", pname=" + pname
                + ", plocation=" + plocation + ", deptNo=" + deptNo + "]";
    }
}