-
Bug
-
Resolution: Done
-
Major
-
2.5.2.Final
-
None
-
False
-
None
-
False
-
Moderate
Bug report
For bug reports, provide this information, please:
What Debezium connector do you use and what version?
Db2 version 2.5.2.Final
What is the connector configuration?
any
Db2 JDBC Jar missing from plugin directory
What is the captured database version and mode of depoyment?
11.5
What behaviour do you expect?
An error that I can handle in my `handle` function
What behaviour do you see?
2024-03-08 08:35:46.246 41 java.lang.NoClassDefFoundError: com.ibm.db2.jcc.DB2Driver
2024-03-08 08:35:46.247 41 at io.debezium.connector.db2.Db2Connection.<clinit>(Db2Connection.java:97)
2024-03-08 08:35:46.248 41 at io.debezium.connector.db2.Db2Connector.validateConnection(Db2Connector.java:80)
2024-03-08 08:35:46.248 41 at io.debezium.connector.common.RelationalBaseSourceConnector.validate(RelationalBaseSourceConnector.java:42)
2024-03-08 08:35:46.254 41 at io.debezium.embedded.EmbeddedEngine.getConnectorConfig(EmbeddedEngine.java:519)
2024-03-08 08:35:46.254 41 at io.debezium.embedded.EmbeddedEngine.run(EmbeddedEngine.java:431)
2024-03-08 08:35:46.255 41 at io.debezium.embedded.ConvertingEngineBuilder$1.run(ConvertingEngineBuilder.java:248)
2024-03-08 08:35:46.257 41 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
2024-03-08 08:35:46.258 41 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
2024-03-08 08:35:46.259 41 at java.base/java.lang.Thread.run(Thread.java:839)
2024-03-08 08:35:46.259 41 Caused by: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver
2024-03-08 08:35:46.260 41 at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:605)
2024-03-08 08:35:46.260 41 at com.ibm.broker.classloading.JavaResourceClassLoader.findClass(JavaResourceClassLoader.java:180)
2024-03-08 08:35:46.261 41 at com.ibm.broker.classloading.SharedClassLoader.findClass(SharedClassLoader.java:230)
2024-03-08 08:35:46.262 41 at java.base/java.lang.ClassLoader.loadClassHelper(ClassLoader.java:1177)
2024-03-08 08:35:46.262 41 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1092)
2024-03-08 08:35:46.263 41 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1075)
2024-03-08 08:35:46.264 41 at com.ibm.broker.classloading.JavaResourceClassLoader.loadClass(JavaResourceClassLoader.java:579)
2024-03-08 08:35:46.265 41 at com.ibm.broker.classloading.SharedClassLoader.loadClass(SharedClassLoader.java:238)
2024-03-08 08:35:46.265 41 at com.ibm.broker.classloading.ReverseDelegationClassLoader.findClass(ReverseDelegationClassLoader.java:135)
2024-03-08 08:35:46.266 41 at java.base/java.lang.ClassLoader.loadClassHelper(ClassLoader.java:1177)
2024-03-08 08:35:46.267 41 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1092)
2024-03-08 08:35:46.267 41 at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1075)
2024-03-08 08:35:46.268 41 at com.ibm.broker.classloading.JavaResourceClassLoader.loadClass(JavaResourceClassLoader.java:579)
with a `null` message going to the handle function
Do you see the same behaviour using the latest relesead Debezium version?
Haven't tried 2.6
Do you have the connector logs, ideally from start till finish?
Yes
How to reproduce the issue using our tutorial deployment?
Use any connector that needs a separate JDBC download (e.g. Db2 or Oracle), and forget to do that!
Fix:
Modify EmbeddedEngine.java `getConnectorConfig` to be:
private Map<String, String> getConnectorConfig(final SourceConnector connector, final String connectorClassName) throws EmbeddedEngineRuntimeException {
Map<String, String> connectorConfig = workerConfig.originalsStrings();
Config validatedConnectorConfig = null;
try{
validatedConnectorConfig = connector.validate(connectorConfig);
{{ }}}
catch (java.lang.NoClassDefFoundError ex){
String msg = "Connector configuration is not valid: "+ex.getMessage();
failAndThrow(msg, ex);
{{ }}}
ConfigInfos configInfos = AbstractHerder.generateResult(connectorClassName, Collections.emptyMap(), validatedConnectorConfig.configValues(),
connector.config().groups());
if (configInfos.errorCount() > 0) {
String errors = configInfos.values().stream()
.flatMap(v -> v.configValue().errors().stream())
.collect(Collectors.joining(" "));
failAndThrow("Connector configuration is not valid. " + errors, null);
{{ }}}
return connectorConfig;
{{ }}}