OpenJPA Exception related to JDBC Driver and connection URL in TomEE+

1k Views Asked by At

We are facing issue in our application with respect to the persistence configuration. The application runs on TomEE Plus (7.0) and uses Open JPA implementation. Below is the error which we are getting

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

We dont' get the above error when using oracle.jdbc.driver.OracleDriver. The XA driver settings were working fine on IBM WebSphere 8.5. Is there anything else which we need to configure in TomEE+ to get it working?

Update

Adding the persistence.xml file as well

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

As mentioned, it works fine if I use oracle.jdbc.driver.OracleDriver as the jdbc driver class

0

There are 0 best solutions below