我们在应用程序中遇到有关持久性配置的问题。该应用程序在TomEE Plus(7.0)上运行并使用Open JPA实现。以下是我们得到的错误
<openjpa-2.4.2-r422266:1777108 nonfatal general error> org.apache.openjpa.persistence.PersistenceException: There were errors initializing your configuration: <openjpa-2.4.2-r422266:1777108 fatal user error> org.apache.openjpa.util.UserException: A connection could not be obtained for driver class "oracle.jdbc.xa.client.OracleXADataSource" and URL "jdbc:oracle:thin:@//mydburl.abc.com:1881/MYSID.ABC.COM". You may have specified an invalid URL.
使用oracle.jdbc.driver.OracleDriver
时,我们不会收到上述错误。 XA
驱动程序设置在IBM WebSphere 8.5上运行良好。我们还需要在TomEE +中配置其他任何东西以使其正常工作吗?
更新
添加persistence.xml
文件
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="1.0">
<persistence-unit name="MySchema" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>myjndi</jta-data-source>
<class>com.abc.jpa.entity.Tuser</class>
<class>com.abc.jpa.entity.Taddress</class>
<properties>
<property name="tomee.jpa.factory.lazy" value="true"></property>
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.xa.client.OracleXADataSource" />
<property name="javax.persistence.jdbc.url"
value="jdbc:oracle:thin:@//mydburl.abc.com:1881/MYSID.ABC.COM" />
<property name="javax.persistence.jdbc.user" value="userName" />
<property name="javax.persistence.jdbc.password" value="password" />
</properties>
</persistence-unit>
</persistence>
如上所述,如果我使用oracle.jdbc.driver.OracleDriver
作为jdbc驱动程序类