davsclaus opened a new pull request, #30662: URL: https://github.com/apache/camel/pull/30662
[CAMEL-27447](https://issues.apache.org/jira/browse/CAMEL-27447) A route with `debezium-mysql` failed on Camel JBang with `ClassNotFoundException: com.mysql.cj.jdbc.Driver`. The MySQL driver is GPL, so camel-debezium-mysql declares it `provided`. The third-party mapping (`known-third-party-libraries.properties`, CAMEL-24809) knows `com.mysql.cj`, but Debezium loads the driver itself with `Class.forName`, which bypasses the class resolver that downloads it. `debezium-db2` had the same problem with `com.ibm.db2.jcc.DB2Driver`, which is `provided` in debezium-connector-db2 (IBM IPLA license). ### Changes - `DependencyDownloaderComponentResolver` already resolved one class for `activemq` / `activemq6` (pooled-jms), so that the class resolver downloads its library. That `if` is now a small map from component name to class, with two new entries: - `debezium-mysql` → `com.mysql.cj.jdbc.Driver` - `debezium-db2` → `com.ibm.db2.jcc.DB2Driver` - The export's run records every download, so `camel export` adds the driver too, with no change to camel-jbang-core. A driver the user adds (`--dep`, `camel.jbang.dependencies`, project POM) is already on the classpath, so nothing is downloaded. - New mapping `com.ibm.db2.jcc = com.ibm.db2:jcc:${debezium-db2-jcc-version}`, with the new parent property `debezium-db2-jcc-version` = 12.1.5.0 (newest regular release on Central). The MySQL driver keeps `${debezium-mysql-connector-version}`. - Camel itself still has no dependency on either driver. - The other connectors are not affected, because their driver is a runtime dependency: oracle (ojdbc11), sqlserver (mssql-jdbc), postgres (postgresql), mongodb (mongodb-driver-sync). - Docs: - `camel-jbang-running.adoc` lists the components that get such a library. - debezium-mysql and debezium-db2 say the CLI downloads the driver and `camel export` adds it. - 4.24 upgrade-guide entry. ### Tests - `DependencyDownloaderComponentResolverTest` (new cases), with the real class resolver and known-dependencies resolver and a recording downloader: - debezium-mysql asks for `com.mysql:mysql-connector-j` once, debezium-db2 for `com.ibm.db2:jcc` once. - postgres, sqlserver, oracle and mongodb ask only for their Camel artifact. - activemq still asks for pooled-jms. - Without the new map entries, the mysql and db2 tests fail. - `mvn test -Dtest=org.apache.camel.main.download.*Test` in camel-kamelet-main: 88 tests, all green. - End to end, the CLI ran with the branch jar against the old one, with a throwaway home: - `debezium-mysql` against MySQL 8.4 in Docker: the old jar fails with the `ClassNotFoundException`. The new jar takes the snapshot and streams a row inserted while it runs. - `debezium-db2` without a database: the old jar fails with `NoClassDefFoundError: com/ibm/db2/jcc/DB2Driver`. The new jar downloads `jcc-12.1.5.0.jar` and fails with "Connection refused" from `DB2Driver.connect`. - `camel export` for camel-main, spring-boot and quarkus: the old jar's pom has no driver. The new jar's pom lists `com.mysql:mysql-connector-j:26.10.0`, and the Db2 export (camel-main) lists `com.ibm.db2:jcc:12.1.5.0`. ### For the review - Debezium 3.7.1 builds against Db2 driver 11.5.0.0. I picked 12.1.5.0, the current release. 11.5.9.0 is the newest of the 11.5 line, if we would rather stay closer to Debezium. - With the new `com.ibm.db2.jcc` mapping, a sql/jdbc route with a Db2 datasource now gets the driver downloaded too, like the other JDBC drivers. _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
