Usage of DB2 XA Driver ends up with error com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError
See original GitHub issueDescribe the bug
Running on a Windows 10 64-bit using Quarkus 2.6.1.Final
following the relevant dependencies I have for connecting to a DB2 instance:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-db2</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc_license_cisuz</artifactId>
<version>11.1</version>
</dependency>
The settings in application.properties
are as the folloiwng:
%prod.quarkus.datasource.P82DataSource.db-kind=${P82_KIND:db2}
%prod.quarkus.datasource.P82DataSource.jdbc.url=${P82_URL}
%prod.quarkus.datasource.P82DataSource.username=${P82_USER}
%prod.quarkus.datasource.P82DataSource.password=${P82_PASS}
The value of P82_URL
is jdbc:db2://<IP_ADDRESS>:446/<DATABASE_NAME>
.
The application runs without any issue using this setup as one can see below (both in JVM as well as native mode):
...
2022-01-07 04:24:42,704 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.14.0 (camel-1) started in 401ms (build:0ms init:385ms start:16ms)
2022-01-07 04:24:42,820 INFO [io.quarkus] (main) my-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 2.211s. Listening on: http://0.0.0.0:8080
2022-01-07 04:24:42,820 INFO [io.quarkus] (main) Profile prod activated.
2022-01-07 04:24:42,820 INFO [io.quarkus] (main) Installed features: [agroal, artemis-jms, camel-core, camel-direct, camel-jms, camel-jta, camel-log, camel-micrometer, camel-microprofile-health, camel-xpath, camel-xslt, cdi, jdbc-db2, jdbc-h2, micrometer, narayana-jta, smallrye-context-propagation, smallrye-health, vertx]
...
Now if I ask for the XA driver using:
%prod.quarkus.datasource.P82DataSource.jdbc.transactions=xa
Then the application fails to load the XA driver with the following message on startup:
2022-01-07 04:25:51,916 WARN [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
2022-01-07 04:25:51,916 WARN [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
...
...
2022-01-07 04:25:52,918 INFO [org.apa.cam.imp.eng.AbstractCamelContext] (main) Apache Camel 3.14.0 (camel-1) started in 432ms (build:0ms init:400ms start:32ms)
2022-01-07 04:25:53,013 INFO [io.quarkus] (main) my-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 1.946s. Listening on: http://0.0.0.0:8080
2022-01-07 04:25:53,013 INFO [io.quarkus] (main) Profile prod activated.
2022-01-07 04:25:53,013 INFO [io.quarkus] (main) Installed features: [agroal, artemis-jms, camel-core, camel-direct, camel-jms, camel-jta, camel-log, camel-micrometer, camel-microprofile-health, camel-xpath, camel-xslt, cdi, jdbc-db2, jdbc-h2, micrometer, narayana-jta, smallrye-context-propagation, smallrye-health, vertx]
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\IBM\SQLLIB\BIN\db2jcct2.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform: ERRORCODE=-4472, SQLSTATE=null
at com.ibm.db2.jcc.am.b7.a(b7.java:794)
at com.ibm.db2.jcc.am.b7.a(b7.java:66)
at com.ibm.db2.jcc.am.b7.a(b7.java:107)
at com.ibm.db2.jcc.t2.a.a(a.java:37)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\IBM\SQLLIB\BIN\db2jcct2.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform: ERRORCODE=-4472, SQLSTATE=null
at com.ibm.db2.jcc.am.b7.a(b7.java:794)
at com.ibm.db2.jcc.am.b7.a(b7.java:66)
at com.ibm.db2.jcc.am.b7.a(b7.java:107)
at com.ibm.db2.jcc.t2.a.a(a.java:37)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
...
The file C:\Program Files (x86)\IBM\SQLLIB\BIN\db2jcct2.dll
is existing on the machine. I have also WSL on the same machine. Again using plain JDBC driver works perfectly but switching to XA driver results in a similar error:
2022-01-07 04:28:52,993 WARN [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
2022-01-07 04:28:52,993 WARN [io.agr.pool] (main) Datasource 'P82DataSource': Ignoring property 'URL': No setter in class com.ibm.db2.jcc.DB2XADataSource
...
...
2022-01-07 04:28:53,759 INFO [io.quarkus] (main) my-app 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.1.Final) started in 1.632s. Listening on: http://0.0.0.0:8080
2022-01-07 04:28:53,760 INFO [io.quarkus] (main) Profile prod activated.
2022-01-07 04:28:53,760 INFO [io.quarkus] (main) Installed features: [agroal, artemis-jms, camel-core, camel-direct, camel-jms, camel-jta, camel-log, camel-micrometer, camel-microprofile-health, camel-xpath, camel-xslt, cdi, jdbc-db2, jdbc-h2, micrometer, narayana-jta, smallrye-context-propagation, smallrye-health, vertx]
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib: ERRORCODE=-4472, SQLSTATE=null
at com.ibm.db2.jcc.am.b7.a(b7.java:794)
at com.ibm.db2.jcc.am.b7.a(b7.java:66)
at com.ibm.db2.jcc.am.b7.a(b7.java:107)
at com.ibm.db2.jcc.t2.a.a(a.java:37)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
com.ibm.db2.jcc.am.SqlException: [jcc][10389][12245][4.29.24] Failure in loading native library db2jcct2, java.lang.UnsatisfiedLinkError: no db2jcct2 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib: ERRORCODE=-4472, SQLSTATE=null
at com.ibm.db2.jcc.am.b7.a(b7.java:794)
at com.ibm.db2.jcc.am.b7.a(b7.java:66)
at com.ibm.db2.jcc.am.b7.a(b7.java:107)
at com.ibm.db2.jcc.t2.a.a(a.java:37)
at com.ibm.db2.jcc.t2.T2Configuration.<clinit>(T2Configuration.java:95)
at com.ibm.db2.jcc.DB2BaseDataSource.instantiateLogWriter(DB2BaseDataSource.java:12359)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12271)
at com.ibm.db2.jcc.DB2BaseDataSource.computeJccLogWriterForNewConnection(DB2BaseDataSource.java:12224)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:159)
at com.ibm.db2.jcc.DB2XADataSource.getXAConnection(DB2XADataSource.java:134)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:216)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:513)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:494)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
...
The warning message at the very first begining seems to be from: https://github.com/agroal/agroal/blob/master/agroal-pool/src/main/java/io/agroal/pool/util/PropertyInjector.java#L46
Any help is much appreciated.
cc: @gsmet @barreiro @aguibert
Expected behavior
I expect to see the XA Driver usage works the same as the JDBC driver.
Actual behavior
The usage of XA Driver fails.
How to Reproduce?
No response
Output of uname -a
or ver
MINGW64_NT-10.0-18363 XYZ 3.1.7-340.x86_64 2021-10-12 16:29 UTC x86_64 Msys
Output of java -version
openjdk version “17.0.1” 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.6.1.Final
Build tool (ie. output of mvnw --version
or gradlew --version
)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\Develop\apache-maven-3.8.4 Java version: 17.0.1, vendor: GraalVM Community, runtime: C:\Develop\graalvm-17 Default locale: en_US, platform encoding: Cp1252 OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”
Additional information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:17 (6 by maintainers)
Top GitHub Comments
hi @bvahdat , could you open a new issue for the Oracle XA problem and attach a reproducer please? Ideally one without Camel as that would help me a lot 😃 Thanks
And just to emphasize the point that with applying those changes above (missings.txt) I was able to successfully run in native mode without any error.