解决方案 »

  1.   

     A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
    ConnectionDriverName属性没有配置,发下配置看看
      

  2.   

    检查一下 数据源 配置, 看你的异常应该是 使用 JTA 事物 ,容器没有实例化 EntityManager  
      

  3.   

    <persistence-unit name="main-persistence" transaction-type="RESOURCE_LOCAL">
    <class>org.hibernate.ejb.HibernatePersistence</class>
    <properties>
    <!-- 数据库方言 -->
    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
    <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
    <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/sm?useUnicode=true&amp;characterEncoding=utf-8" />
    <property name="hibernate.connection.username" value="root" />
    <property name="hibernate.connection.password" value="root" />
            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>   
            <property name="hibernate.show_sql" value="true" />  
            <property name="hibernate.jdbc.batch_size" value="10"/>
    <property name="connection.autoReconnect" value="true"/> 
            <property name="connection.autoReconnectForPools" value="true"/> 
            <property name="connection.is-connection-validation-required" value="true"/> 
    </properties>
    </persistence-unit>
      

  4.   

    <persistence-unit name="main-persistence" transaction-type="RESOURCE_LOCAL">
    <class>org.hibernate.ejb.HibernatePersistence</class>
    <properties>
    <!-- 数据库方言 -->
    <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
    <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
    <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/sm?useUnicode=true&amp;characterEncoding=utf-8" />
    <property name="hibernate.connection.username" value="root" />
    <property name="hibernate.connection.password" value="root" />
            <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>   
            <property name="hibernate.show_sql" value="true" />  
            <property name="hibernate.jdbc.batch_size" value="10"/>
    <property name="connection.autoReconnect" value="true"/> 
            <property name="connection.autoReconnectForPools" value="true"/> 
            <property name="connection.is-connection-validation-required" value="true"/> 
    </properties>
    </persistence-unit>
      

  5.   

    <?xml version="1.0" encoding="UTF-8"?>
    <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="coffee" transaction-type="JTA">
    <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
    <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/oracleds)</jta-data-source>

    <class>com.inetpsa.coffee.example.representations.DepartmentRepresentation</class>
    <class>com.inetpsa.coffee.example.representations.EmployeeRepresentation</class>

    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <properties>
    <property name="openjpa.LockManager" value="pessimistic"/>
    </properties>
    </persistence-unit>
    </persistence>参考下,
      

  6.   

     A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
    说的清楚啊!你的driver的name找不到匹配的驱动!好像是driverClass不是driver_class!