I am getting below error while deploying flink application to AWS account.

java.lang.NoSuchMethodError: 'org.apache.flink.metrics.MetricGroup org.apache.flink.api.common.functions.RuntimeContext.getMetricGroup()'
at software.amazon.kinesis.connectors.flink.internals.KinesisDataFetcher.<init>(KinesisDataFetcher.java:429)
at software.amazon.kinesis.connectors.flink.internals.KinesisDataFetcher.<init>(KinesisDataFetcher.java:380)
at software.amazon.kinesis.connectors.flink.FlinkKinesisConsumer.createFetcher(FlinkKinesisConsumer.java:473)
at software.amazon.kinesis.connectors.flink.FlinkKinesisConsumer.run(FlinkKinesisConsumer.java:289)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:67)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:332)

I am using below versions for different dependencies, not sure which version is causing this issue.


dependencies {
    compileOnly('org.projectlombok:lombok:1.18.26')
    annotationProcessor('org.projectlombok:lombok:1.18.26')
    implementation('com.amazonaws:aws-lambda-java-core:1.2.2')
    implementation('org.apache.logging.log4j:log4j-core:2.20.0')
    implementation('com.fasterxml.jackson.core:jackson-databind:2.15.1')
    implementation("org.apache.flink:flink-connector-kinesis:1.15.4")
    compileOnly('org.apache.flink:flink-streaming-java:1.15.4')
    implementation('com.amazonaws:aws-java-sdk-lambda:1.12.472')
    implementation('software.amazon.kinesis:amazon-kinesis-connector-flink:2.3.0')
    implementation('com.amazonaws:aws-kinesisanalytics-flink:2.0.0')
    implementation("com.amazonaws:aws-kinesisanalytics-runtime:1.2.0")
    implementation('com.amazonaws:aws-java-sdk-appconfig:1.12.471')
    implementation("software.amazon.awssdk:appconfig:2.20.121")

    testImplementation('org.mockito:mockito-core:2.22.0')
    testImplementation('org.mockito:mockito-inline:3.4.0')
    testImplementation('org.junit.jupiter:junit-jupiter:5.7.1')
    testImplementation("org.apache.flink:flink-test-utils_2.12:1.11.1")
    testImplementation("org.powermock:powermock-api-mockito2:2.0.9")
    testImplementation("org.powermock:powermock-module-junit4:2.0.9")
    testImplementation('org.apache.flink:flink-streaming-java_2.12:1.14.4:tests')
    testImplementation('org.apache.flink:flink-runtime_2.12:1.13.6')
    compileOnly('org.projectlombok:lombok:1.18.26')
    annotationProcessor("org.projectlombok:lombok:1.18.22")
}

Can someone please help me to figure out the issue?

Thanks!

I tried to update the version of some dependancies as suggested by some sage answer, but that not helped me.

1

There are 1 answers

0
Andy C On BEST ANSWER

Looks like you are using Flink 1.15 but inclding dependencies for Flink 1.8/1.11.

Suggest you just remove the wrong dependency:

software.amazon.kinesis:amazon-kinesis-connector-flink:2.3.0