Project doesn't get compiled with Java 17 after upgrading Oracle aqapi to aqapi-jakarta

276 views Asked by At

Upgrade from Spring 5 to Spring 6 (Spring Boot v2 — v3) brings Jakarta EE 9+ with it. This makes com.oracle.database.messaging:aqapi to be incompatible because the ConnectionFactory class moved from javax package to jakarta package.

This one can be solved by replacing the com.oracle.database.messaging:aqapi with com.oracle.database.messaging:aqapi-jakarta dependency.

But after this replacement the project doesn't get compiled with the error: createShardingKeyBuilder() in cannot implement createShardingKeyBuilder() in javax.sql.CommonDataSource return type oracle.jdbc.OracleShardingKeyBuilder is not compatible with java.sql.ShardingKeyBuilder or it can be createShardingKeyBuilder in oracle.ucp.jdbc.PoolDataSource clashes with createShardingKeyBuilder in javax.sql.CommonDataSource.

1

There are 1 answers

0
Ed Gomoliako On

The problem lies in com.oracle.database.jdbc:ojdbc dependency.

com.oracle.database.messaging:aqapi-jakarta is depended on com.oracle.database.jdbc:ojdbc8 but to make Oracle JDBC work under Java17 one needs com.oracle.database.jdbc:ojdbc11.

Thus the pom.xml should have the dependencies specified in the following way:

    <dependency>
      <groupId>com.oracle.database.messaging</groupId>
      <artifactId>aqapi-jakarta</artifactId>
      <version>23.2.1.0</version>
      <exclusions>
        <exclusion>
          <groupId>com.oracle.database.jdbc</groupId>
          <artifactId>ojdbc8</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.oracle.database.jdbc</groupId>
      <artifactId>ojdbc11</artifactId>
      <version>23.2.0.0</version>
    </dependency>