Furkan ALAYBEG
10/20/2023, 7:59 AMSinkFunction<BillDataMapper> jdbcSink = JdbcSink.sink("INSERT INTO MYDB.FLINKTEST (GSM, AMOUNT) VALUES (?, ?)",
(ps, data) ->{
ps.setString(1, data.getGsm());
ps.setString(2, Double.toString(data.getBillAmount()));
},
JdbcExecutionOptions.builder()
.withMaxRetries(3)
.withBatchSize(100)
.withBatchIntervalMs(3000)
.build(),
new JdbcConnectionOptions.JdbcConnectionOptionsBuilder()
.withUrl("jdbc:phoenix:myflink.local,myflink.local,myflink.local,:2181:/hbase:myuser@SYSTEM.LOCAL:/home/mypc/mypc.keytab")
.withDriverName("org.apache.phoenix.jdbc.PhoenixDriver")
.withConnectionCheckTimeoutSeconds(60)
.build());
billStream.addSink(jdbcSink);
billStream.print();Pedro Mázala
10/20/2023, 8:02 AMFurkan ALAYBEG
10/20/2023, 8:03 AMFurkan ALAYBEG
10/20/2023, 8:04 AM<dependency>
<groupId>org.apache.phoenix</groupId>
<artifactId>phoenix-core</artifactId>
<version>5.1.1.7.1.7.2000-305</version>
<scope>provided</scope>
</dependency>
For example, I try with this and get error, then try with another jar dependencyPedro Mázala
10/20/2023, 8:06 AM...jdbc.PhoenixDriver is present on which jar? Is this jar packed with your environment?Furkan ALAYBEG
10/20/2023, 8:09 AMFurkan ALAYBEG
10/20/2023, 8:10 AMFurkan ALAYBEG
10/20/2023, 8:10 AMPedro Mázala
10/20/2023, 8:12 AM/flink/lib ?Furkan ALAYBEG
10/20/2023, 8:14 AMPedro Mázala
10/20/2023, 8:27 AMFurkan ALAYBEG
10/20/2023, 8:28 AMPedro Mázala
10/20/2023, 8:31 AMSergey Nuyanzin
10/20/2023, 9:56 AMNoClassDefFoundError couold not only mean class not found, also it could mean ExceptionInInitializerError happened earlier...
this could happen if some jars from /flink/lib depend on one set of dependencies and versions and Phoenix jar depends on different versions...
so I would double check dependencies for both against conflicts in versionsPedro Mázala
10/20/2023, 10:03 AM