Could not open JPA EntityManager for transaction

J2EE 码拜 10年前 (2015-04-02) 3204次浏览 0个评论

 Could not open JPA EntityManager for transactionnested exception is <openjpa-1.2.2-r422266:898935 fatal user error> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
这个问题  搞了好半天 啊  没有解决啊

Could not open JPA EntityManager for transaction
 A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
ConnectionDriverName属性没有配置,发下配置看看
Could not open JPA EntityManager for transaction
34分
检查一下 数据源 配置, 看你的异常应该是 使用 JTA 事物 ,容器没有实例化 EntityManager  
Could not open JPA EntityManager for transaction
<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>
Could not open JPA EntityManager for transaction
引用 2 楼 lvzg_005 的回复:

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

<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>

Could not open JPA EntityManager for transaction
<?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>

参考下,

Could not open JPA EntityManager for transaction
 A JDBC Driver or DataSource class name must be specified in the ConnectionDriverName property.
说的清楚啊!你的driver的name找不到匹配的驱动!好像是driverClass不是driver_class!
Could not open JPA EntityManager for transaction
http://blog.csdn.net/dongja3/article/details/44617137

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明Could not open JPA EntityManager for transaction
喜欢 (0)
[1034331897@qq.com]
分享 (0)

文章评论已关闭!