java.lang.RuntimeException:无法解析 Oracle 数据库版本

Posted

技术标签:

【中文标题】java.lang.RuntimeException:无法解析 Oracle 数据库版本【英文标题】:java.lang.RuntimeException: Failed to resolve Oracle database version 【发布时间】:2021-11-04 08:36:38 【问题描述】:

我在 kafka 连接中使用 debezium oracle 连接器。启动连接器时出现以下错误,

java.lang.RuntimeException: Failed to resolve Oracle database version
        at io.debezium.connector.oracle.OracleConnection.resolveOracleDatabaseVersion(OracleConnection.java:159)
        at io.debezium.connector.oracle.OracleConnection.<init>(OracleConnection.java:71)
        at io.debezium.connector.oracle.OracleConnector.validateConnection(OracleConnector.java:74)
        at io.debezium.connector.common.RelationalBaseSourceConnector.validate(RelationalBaseSourceConnector.java:52)
        at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:400)
        at org.apache.kafka.connect.runtime.AbstractHerder.lambda$validateConnectorConfig$2(AbstractHerder.java:351)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@**.**.*.**:1521/CDB
        at java.sql.DriverManager.getConnection(DriverManager.java:689)
        at java.sql.DriverManager.getConnection(DriverManager.java:208)
        at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$0(JdbcConnection.java:184)
        at io.debezium.jdbc.JdbcConnection$ConnectionFactoryDecorator.connect(JdbcConnection.java:121)
        at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:890)
        at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:885)
        at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:643)
        at io.debezium.jdbc.JdbcConnection.queryAndMap(JdbcConnection.java:517)
        at io.debezium.connector.oracle.OracleConnection.resolveOracleDatabaseVersion(OracleConnection.java:129)
        ... 10 more

我指的是oracle设置和连接器配置的链接,

**https://debezium.io/documentation/reference/connectors/oracle.html#setting-up-oracle**

connector-configuration.properties

name=debeziumoraclesource
connector.class=io.debezium.connector.oracle.OracleConnector
database.hostname=**.*.**.**
database.port=1521
database.user=username
database.password=password
database.dbname=CDBNAME
database.server.name=**.*.**.**
tasks.max=1
database.pdb.name=PDBNAME
database.history.kafka.bootstrap.servers=kafka:9092
database.history.kafka.topic=history.ENTITY_GROUP_PARAMETER_VALUES
database.connection.adaptor=logminer
snapshot.mode=initial
table.include.list=schema.ENTITY_GROUP_PARAMETER_VALUES

我还下载了 ojdbc8.jar 并放在 kafka/libs 文件夹中。我尝试使用不同版本的 jars,如 ojdbc10 和不同版本的 ojdbc8。没有什么帮助我。还有一点我正在使用 oracle19c。请帮我解决这个问题。在此先感谢。

【问题讨论】:

【参考方案1】:

使用带有所有依赖项的 OJDBC6.jar 帮助我解决了这个问题。最重要的是,我将罐子放在 connector lib 文件夹中。

【讨论】:

以上是关于java.lang.RuntimeException:无法解析 Oracle 数据库版本的主要内容,如果未能解决你的问题,请参考以下文章

Android Studio 按钮导致崩溃

添加 ImageView 时应用程序崩溃?