Hi Everyone, I am faing issue while using the Dyna...
# troubleshooting
a
Hi Everyone, I am faing issue while using the DynamoDB SQL Jar in flink 1.17.2 Steps I have done 1. Downloaded the Jar 2. Putted the Jar in libs location. Still I am getting the aws sdk error of class not found. Is there something i am missing here, other dependent jars i need to add?
a
Hi, could you provide error you’re getting? Which class is not found?
a
Hi @Aleksandr Pilipenko - First I was getting the error of software/amazon/awssdk/utils/SdkAutoCloseable, than i have added the jar of the util that is resolved again then there was a issue software/amazon/awssdk/enhanced/dynamodb/TableSchema. I think again i need to add the another dependent jar dynamodb. Wanted to know the jar should have been on top of dependent jars, so why i am getting error to add dependent jars manually one by one
a
Could you share a bit more details of how you’re using aws sdk here? Based on what you provided, you trying to access dynamodb classes directly? In this case you need to load sdk classes separately from sql connector jar. Assuming that you’re using
flink-sql-connector-dynamodb
jar, sdk classes that are packaged in this jar are relocated in order to prevent conflicts if your job uses different version of the sdk class outside of connector code. Package of these classes will start with
org.apache.flink.connector.dynamodb.shaded.
, e.g.
org.apache.flink.connector.dynamodb.shaded.software.amazon.awssdk.utils.SdkAutoCloseable
for SdkAutoCloseable class you’ve mentioned before.
a
I am running the pyflink job have added this jar in /opt/flink/lib location also added the jar using env.add_jars(flink-sql-connector-dynamodb-4.2.0-1.17.jar) I have created the table of dynamodb using sql and trying to insert the data . I am getting the inter dependent jars class not found issue.
@Aleksandr Pilipenko - Is there a solution can you please help out or any doc to resolve it
a
I was trying to reproduce the issue, however it worked for me both with SQL client and python. Note, I did not put connector jar in lib folder, only added through
pipeline.jars
What I’ve tried (adjusted example from docs):
Copy code
from pyflink.table import EnvironmentSettings, TableEnvironment
from pyflink.table.expressions import col

env_settings = EnvironmentSettings.in_streaming_mode()
table_env = TableEnvironment.create(env_settings)

table_env.get_config().set("pipeline.jars", "file:///<path_to_jar>/flink-sql-connector-dynamodb-4.2.0-1.17.jar")

table_env.execute_sql("""
    CREATE TABLE datagen (
        Artist STRING,
        SongTitle STRING
    ) WITH (
        'connector' = 'datagen',
        'number-of-rows' = '20',
        'fields.Artist.length' = '10',
        'fields.SongTitle.length' = '10'
    )
""")
table_env.execute_sql("""
    CREATE TABLE DynamoDbTable (
      `Artist` STRING,
      `SongTitle` STRING
    )
    WITH (
      'connector' = 'dynamodb',
      'table-name' = 'MusicCollection',
      'aws.region' = 'eu-west-1'
    )
""")

source_table = table_env.execute_sql("""insert into DynamoDbTable(Artist, SongTitle) select Artist, SongTitle from datagen""")
a
@Aleksandr Pilipenko - I tried running using sql client simple adding jar still same issue
a
@amarjeet pasrija could you please share some details around your setup? Do you have any other dependencies added? What do you use as a source? Is there other operations that can use aws sdk in your job?
a
@Aleksandr Pilipenko - I have added the extra dependent it is resolved. I was running a docker container in EC2 machine. Use Kafka as Source. And using S3 jar as plugin.