apache / seatunnel

SeaTunnel is a next-generation super high-performance, distributed, massive data integration tool.
https://seatunnel.apache.org/
Apache License 2.0
8.01k stars 1.82k forks source link

[Bug] [mysql-cdc] mysql-cdc Failed to get driver instance for jdbcUrl #4959

Closed ocean-zhc closed 1 year ago

ocean-zhc commented 1 year ago

Search before asking

What happened

通过官网Mysql CDC 同步到ES,发现Mysql-cdc没有驱动配置项,在同步过程中,出现如下错误 Caused by: java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:mysql://localhost:3306/test at com.zaxxer.hikari.util.DriverDataSource.(DriverDataSource.java:114) at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:331) at com.zaxxer.hikari.pool.PoolBase.(PoolBase.java:114) at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:108) at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:81) at org.apache.seatunnel.connectors.cdc.base.relational.connection.JdbcConnectionPoolFactory.createPooledDataSource(JdbcConnectionPoolFactory.java:52) at org.apache.seatunnel.connectors.cdc.base.relational.connection.JdbcConnectionPools.getOrCreateConnectionPool(JdbcConnectionPools.java:56) at org.apache.seatunnel.connectors.cdc.base.relational.connection.JdbcConnectionFactory.connect(JdbcConnectionFactory.java:60) at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:890) at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:885) at io.debezium.jdbc.JdbcConnection.connect(JdbcConnection.java:418) at org.apache.seatunnel.connectors.cdc.base.dialect.JdbcDataSourceDialect.openJdbcConnection(JdbcDataSourceDialect.java:52) ... 9 more Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:315) at com.zaxxer.hikari.util.DriverDataSource.(DriverDataSource.java:106) ... 20 more

SeaTunnel Version

2.3.2

SeaTunnel Config

env {
      execution.parallelism = 1
      job.mode = "STREAMING"
      job.name = "mysqlcdc2es"
      checkpoint.interval = 15000
    }

    source {
      MySQL-CDC {
        result_table_name = "table1"
        username = "user"
        password = "pwd"
        hostname = 127.0.0.1
        base-url="jdbc:mysql://127.0.0.1:3306/test"
        startup.mode=INITIAL
        catalog {
            factory=MySQL
        }
        table-names=[
            "test.two"
        ]
        # compatible_debezium_json options
        # format = compatible_debezium_json
        debezium = {
            # include schema into kafka message
            key.converter.schemas.enable = false
            value.converter.schemas.enable = false
            # include ddl
            include.schema.changes = true
        }
        # compatible_debezium_json fixed schema
        schema = {
            fields = {
                id = "int"
                lrrq = "string"
            }
        }
      }
    }

    transform {
      Sql {
        source_table_name = "table1"
        result_table_name = "table2"
        query = "select id, lrrq from table1"
      }
    }

    sink {
        Elasticsearch {
            source_table_name = "table2"
            hosts = ["127.0.0.1:9200"]
            index = "two"
            primary_keys = ["id"]
        }
    }

Running Command

./bin/seatunnel.sh --config config/mysqlcdd2esstream.conf -e local

Error Exception

Exception in thread "main" org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
        at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:188)
        at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
        at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:34)
Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: org.apache.seatunnel.engine.server.checkpoint.CheckpointException: CheckpointCoordinator inside have error.
        at org.apache.seatunnel.engine.server.checkpoint.CheckpointCoordinator.handleCoordinatorError(CheckpointCoordinator.java:253)
        at org.apache.seatunnel.engine.server.checkpoint.CheckpointCoordinator.reportCheckpointErrorFromTask(CheckpointCoordinator.java:319)
        at org.apache.seatunnel.engine.server.checkpoint.CheckpointManager.reportCheckpointErrorFromTask(CheckpointManager.java:182)
        at org.apache.seatunnel.engine.server.checkpoint.operation.CheckpointErrorReportOperation.run(CheckpointErrorReportOperation.java:44)
        at com.hazelcast.spi.impl.operationservice.Operation.call(Operation.java:189)
        at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.call(OperationRunnerImpl.java:273)
        at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:248)
        at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:213)
        at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:175)
        at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:139)
        at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.executeRun(OperationThread.java:123)
        at com.hazelcast.internal.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:102)
Caused by: org.apache.seatunnel.common.utils.SeaTunnelException: org.apache.seatunnel.common.utils.SeaTunnelException: java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:mysql://127.0.0.1:3306/test
        at org.apache.seatunnel.connectors.cdc.base.dialect.JdbcDataSourceDialect.openJdbcConnection(JdbcDataSourceDialect.java:54)
        at org.apache.seatunnel.connectors.seatunnel.cdc.mysql.source.MySqlDialect.discoverDataCollections(MySqlDialect.java:83)
        at org.apache.seatunnel.connectors.seatunnel.cdc.mysql.source.MySqlDialect.discoverDataCollections(MySqlDialect.java:46)
        at org.apache.seatunnel.connectors.cdc.base.source.IncrementalSource.createEnumerator(IncrementalSource.java:194)
        at org.apache.seatunnel.engine.server.task.SourceSplitEnumeratorTask.restoreState(SourceSplitEnumeratorTask.java:183)
        at org.apache.seatunnel.engine.server.checkpoint.operation.NotifyTaskRestoreOperation.lambda$null$0(NotifyTaskRestoreOperation.java:106)
        at java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1626)
        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.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:mysql://192.168.201.83:3306/test
        at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:114)
        at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:331)
        at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:114)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
        at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
        at org.apache.seatunnel.connectors.cdc.base.relational.connection.JdbcConnectionPoolFactory.createPooledDataSource(JdbcConnectionPoolFactory.java:52)
        at org.apache.seatunnel.connectors.cdc.base.relational.connection.JdbcConnectionPools.getOrCreateConnectionPool(JdbcConnectionPools.java:56)
        at org.apache.seatunnel.connectors.cdc.base.relational.connection.JdbcConnectionFactory.connect(JdbcConnectionFactory.java:60)
        at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:890)
        at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:885)
        at io.debezium.jdbc.JdbcConnection.connect(JdbcConnection.java:418)
        at org.apache.seatunnel.connectors.cdc.base.dialect.JdbcDataSourceDialect.openJdbcConnection(JdbcDataSourceDialect.java:52)
        ... 9 more
Caused by: java.sql.SQLException: No suitable driver
        at java.sql.DriverManager.getDriver(DriverManager.java:315)
        at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
        ... 20 more

        ... 11 more

        at org.apache.seatunnel.engine.client.job.ClientJobProxy.waitForJobComplete(ClientJobProxy.java:122)
        at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:181)
        ... 2 more

Flink or Spark Version

No response

Java or Scala Version

No response

Screenshots

image

Are you willing to submit PR?

Code of Conduct

zhilinli123 commented 1 year ago

Can you try using the dev branch? It's just a bug that has been fixed for now

uniding commented 1 year ago

Can you try using the dev branch? It's just a bug that has been fixed for now

dev branch ,the same error

zhilinli123 commented 1 year ago

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
######
###### This config file is a demonstration of streaming processing in seatunnel config
######

env {
  execution.parallelism = 1
  job.mode = "STREAMING"
  job.name = "mysqlcdc2es"
  checkpoint.interval = 15000
}

source {
  MySQL-CDC {
    result_table_name = "table1"
    server-id = 5652
    username = "root"
    password = "12345678"
    #     table-names = ["test.test1000004"]
    catalog {
      factory=MySQL
    }
    table-names = ["test.my_bigint_unsigned_table"]
    base-url = "jdbc:mysql://localhost:3306/test"
    debezium = {
      # include schema into kafka message
      key.converter.schemas.enable = false
      value.converter.schemas.enable = false
      # include ddl
//      include.schema.changes = true
    }
    schema = {
      fields = {
        name = "string"
      }
    }
  }
}

transform {
  Sql {
    source_table_name = "table1"
    result_table_name = "table2"
    query = "select name  from table1"
  }
}

sink {

  Console{
    source_table_name = "table2"

  }
}
``` My tests are OK and the current dev branch here is the configuration file
@uniding 
2gamayibuxulong commented 1 year ago

The same error, but macos works fine

2gamayibuxulong commented 1 year ago

need help

  1. I download from https://dlcdn.apache.org/seatunnel/2.3.2/apache-seatunnel-2.3.2-bin.tar.gz
  2. tar -zxvf apache-seatunnel-2.3.2-bin.tar.gz
  3. cd apache-seatunnel-2.3.2
  4. ./bin/install-plugin.sh
  5. touch 1.conf the content is https://github.com/apache/seatunnel/issues/4959#issuecomment-1605994643
  6. ./bin/seatunnel.sh --config 1.conf --deploy-mode local '
  7. then some class not found,I found in maven lib and put them into lib
  8. same error happend:Caused by: java.sql.SQLException: No suitable driver

my fileTree npl@DESKTOP-NRQ9KLB:~/apache-seatunnel-2.3.2$ tree . ├── 1.conf ├── DISCLAIMER ├── LICENSE ├── NOTICE ├── README.md ├── bin │   ├── install-plugin.sh │   ├── seatunnel-cluster.sh │   ├── seatunnel.sh │   ├── start-seatunnel-flink-13-connector-v2.sh │   ├── start-seatunnel-flink-15-connector-v2.sh │   ├── start-seatunnel-spark-2-connector-v2.sh │   ├── start-seatunnel-spark-3-connector-v2.sh │   └── stop-seatunnel-cluster.sh ├── config │   ├── hazelcast-client.yaml │   ├── hazelcast.yaml │   ├── jvm_client_options │   ├── jvm_options │   ├── log4j2.properties │   ├── log4j2_client.properties │   ├── plugin_config │   ├── seatunnel-env.sh │   ├── seatunnel.yaml │   ├── v2.batch.config.template │   └── v2.streaming.conf.template ├── connectors │   ├── plugin-mapping.properties │   └── seatunnel │   ├── connector-amazondynamodb-2.3.2.jar │   ├── connector-assert-2.3.2.jar │   ├── connector-cassandra-2.3.2.jar │   ├── connector-cdc-mysql-2.3.2.jar │   ├── connector-cdc-sqlserver-2.3.2.jar │   ├── connector-clickhouse-2.3.2.jar │   ├── connector-console-2.3.2.jar │   ├── connector-datahub-2.3.2.jar │   ├── connector-dingtalk-2.3.2.jar │   ├── connector-doris-2.3.2.jar │   ├── connector-elasticsearch-2.3.2.jar │   ├── connector-email-2.3.2.jar │   ├── connector-fake-2.3.2.jar │   ├── connector-file-ftp-2.3.2.jar │   ├── connector-file-hadoop-2.3.2.jar │   ├── connector-file-local-2.3.2.jar │   ├── connector-file-oss-2.3.2.jar │   ├── connector-file-s3-2.3.2.jar │   ├── connector-file-sftp-2.3.2.jar │   ├── connector-google-firestore-2.3.2.jar │   ├── connector-google-sheets-2.3.2.jar │   ├── connector-hbase-2.3.2.jar │   ├── connector-hive-2.3.2.jar │   ├── connector-http-base-2.3.2.jar │   ├── connector-http-feishu-2.3.2.jar │   ├── connector-http-github-2.3.2.jar │   ├── connector-http-gitlab-2.3.2.jar │   ├── connector-http-jira-2.3.2.jar │   ├── connector-http-klaviyo-2.3.2.jar │   ├── connector-http-lemlist-2.3.2.jar │   ├── connector-http-myhours-2.3.2.jar │   ├── connector-http-notion-2.3.2.jar │   ├── connector-http-onesignal-2.3.2.jar │   ├── connector-http-wechat-2.3.2.jar │   ├── connector-hudi-2.3.2.jar │   ├── connector-iceberg-2.3.2.jar │   ├── connector-influxdb-2.3.2.jar │   ├── connector-iotdb-2.3.2.jar │   ├── connector-jdbc-2.3.2.jar │   ├── connector-kafka-2.3.2.jar │   ├── connector-kudu-2.3.2.jar │   ├── connector-maxcompute-2.3.2.jar │   ├── connector-mongodb-2.3.2.jar │   ├── connector-neo4j-2.3.2.jar │   ├── connector-openmldb-2.3.2.jar │   ├── connector-pulsar-2.3.2.jar │   ├── connector-rabbitmq-2.3.2.jar │   ├── connector-redis-2.3.2.jar │   ├── connector-s3-redshift-2.3.2.jar │   ├── connector-selectdb-cloud-2.3.2.jar │   ├── connector-sentry-2.3.2.jar │   ├── connector-slack-2.3.2.jar │   ├── connector-socket-2.3.2.jar │   ├── connector-starrocks-2.3.2.jar │   └── connector-tablestore-2.3.2.jar ├── lib │   ├── commons-collections-3.2.2.jar │   ├── commons-configuration2-2.1.1.jar │   ├── hadoop-auth-3.1.4.jar │   ├── hadoop-client-3.3.1.jar │   ├── hadoop-client-runtime-3.3.2.jar │   ├── hadoop-common-3.3.4.jar │   ├── jersey-client-1.19.4.jar │   ├── mysql-connector-j-8.0.33.jar │   ├── seatunnel-hadoop3-3.1.4-uber-2.3.2.jar │   ├── seatunnel-transforms-v2.jar │   ├── stax2-api-3.1.4.jar │   └── woodstox-core-5.0.3.jar ├── licenses │   ├── LICENSE-asm.txt │   ├── LICENSE-avro.txt │   ├── LICENSE-connons-math.txt │   ├── LICENSE-javax-annootation-api.txt │   ├── LICENSE-orc.txt │   ├── LICENSE-parquet-format.txt │   ├── LICENSE-parquet-mr.txt │   ├── LICENSE-protobuf.txt │   ├── LICENSE-scala.txt │   ├── LICENSE-sjf4j.txt │   ├── LICENSE-xz.txt │   └── LICENSE-yetus.txt ├── mvnw ├── mvnw.cmd ├── plugins │   └── README.md ├── starter │   ├── logging │   │   ├── jcl-over-slf4j-1.7.25.jar │   │   ├── log4j-api-2.17.1.jar │   │   ├── log4j-core-2.17.1.jar │   │   ├── log4j-slf4j-impl-2.17.1.jar │   │   └── slf4j-api-1.7.25.jar │   ├── seatunnel-flink-13-starter.jar │   ├── seatunnel-flink-15-starter.jar │   ├── seatunnel-spark-2-starter.jar │   ├── seatunnel-spark-3-starter.jar │   └── seatunnel-starter.jar └── xx.conf

sys-info npl@DESKTOP-NRQ9KLB:~/apache-seatunnel-2.3.2$ uname -r 4.4.0-19041-Microsoft

I also try to build form source code,But also the same error,but sometimes in MacOs dolphinscheduler platform to schedul seatunnel job works fine.

I don't know how to next

hanyouyou13 commented 1 year ago

This problem has been resolved。See 4936。

ocean-zhc commented 1 year ago

Can you try using the dev branch? It's just a bug that has been fixed for now

It's OK! TKS!

ffshen commented 1 year ago

@ocean-zhc hello, could you tell me which jars should be replaced ?i replaced connector-cdc-mysql-2.3.2.jar . and some error happen : Caused by: java.lang.NoSuchMethodError: 'org.apache.seatunnel.api.configuration.Options$TypedOptionBuilder org.apache.seatunnel.api.configuration.Options$OptionBuilder.bigDecimalType()

ocean-zhc commented 1 year ago

@ocean-zhc hello, could you tell me which jars should be replaced ?i replaced connector-cdc-mysql-2.3.2.jar . and some error happen : Caused by: java.lang.NoSuchMethodError: 'org.apache.seatunnel.api.configuration.Options$TypedOptionBuilder org.apache.seatunnel.api.configuration.Options$OptionBuilder.bigDecimalType()

使用dev分支