You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not good at English, so I received help from GPT.
In Kafka version 3.9.0, the method for creating an instance of the SystemTime class has changed.
Previously, you could obtain an instance of SystemTime using new SystemTime(). However, it now appears that SystemTime has adopted the Singleton pattern, requiring you to call SystemTime.getSystemTime() to create an instance.
Below is a portion of the modified source code for the SystemTime class:
class SystemTime implements Time {
private static final SystemTime SYSTEM_TIME = new SystemTime();
public static SystemTime getSystemTime() {
return SYSTEM_TIME;
}
//...
private SystemTime() {
}
}
And below is the part of the JdbcSourceTask in Kafka Connect JDBC version 10.8.0 where the SystemTime field is initialized.
public class JdbcSourceTask extends SourceTask {
//..
public JdbcSourceTask() {
this.time = new SystemTime();
}
public JdbcSourceTask(Time time) {
this.time = time;
}
//..
}
Currently, even with the latest version of Kafka Connect JDBC (10.8.0), it cannot be used with Kafka version 3.9.0 due to the following error.
[2024-11-15 17:29:25,300] ERROR [test-connector-mysql|task-0] Failed to start task test-connector-mysql-0 (org.apache.kafka.connect.runtime.Worker:707)
org.apache.kafka.connect.errors.ConnectException: Instantiation error
at org.apache.kafka.connect.runtime.isolation.Plugins.newPlugin(Plugins.java:142)
at org.apache.kafka.connect.runtime.isolation.Plugins.newTask(Plugins.java:340)
at org.apache.kafka.connect.runtime.Worker.startTask(Worker.java:664)
at org.apache.kafka.connect.runtime.Worker.startSourceTask(Worker.java:592)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.startTask(StandaloneHerder.java:504)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.createConnectorTasks(StandaloneHerder.java:488)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.createConnectorTasks(StandaloneHerder.java:482)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.updateConnectorTasks(StandaloneHerder.java:541)
at org.apache.kafka.connect.runtime.standalone.StandaloneHerder.lambda$null$2(StandaloneHerder.java:255)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1575)
Caused by: org.apache.kafka.common.KafkaException: Could not instantiate class io.confluent.connect.jdbc.source.JdbcSourceTask
at org.apache.kafka.common.utils.Utils.newInstance(Utils.java:405)
at org.apache.kafka.connect.runtime.isolation.Plugins.newPlugin(Plugins.java:140)
... 14 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:501)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:485)
at org.apache.kafka.common.utils.Utils.newInstance(Utils.java:401)
... 15 more
Caused by: java.lang.IllegalAccessError: failed to access class org.apache.kafka.common.utils.SystemTime from class io.confluent.connect.jdbc.source.JdbcSourceTask (org.apache.kafka.common.utils.SystemTime is in unnamed module of loader 'app'; io.confluent.connect.jdbc.source.JdbcSourceTask is in unnamed module of loader org.apache.kafka.connect.runtime.isolation.PluginClassLoader @63021689)
at io.confluent.connect.jdbc.source.JdbcSourceTask.<init>(JdbcSourceTask.java:78)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
... 18 more
The text was updated successfully, but these errors were encountered:
I am not good at English, so I received help from GPT.
In Kafka version
3.9.0
, the method for creating an instance of theSystemTime
class has changed.Previously, you could obtain an instance of
SystemTime
usingnew SystemTime()
. However, it now appears thatSystemTime
has adopted the Singleton pattern, requiring you to callSystemTime.getSystemTime()
to create an instance.Below are the related Kafka 3.9.0 release notes and the GitHub link to the changes:
https://issues.apache.org/jira/browse/KAFKA-16879
apache/kafka#16266
Below is a portion of the modified source code for the
SystemTime
class:And below is the part of the
JdbcSourceTask
in Kafka Connect JDBC version10.8.0
where theSystemTime
field is initialized.Currently, even with the latest version of Kafka Connect JDBC (
10.8.0
), it cannot be used with Kafka version3.9.0
due to the following error.The text was updated successfully, but these errors were encountered: