awslabs / kinesis-kafka-connector

kinesis-kafka-connector is connector based on Kafka Connect to publish messages to Amazon Kinesis streams or Amazon Kinesis Firehose.
Apache License 2.0
153 stars 91 forks source link

NoSuchMethodError when running connect-standalone with this plugin #18

Open jevonearth opened 6 years ago

jevonearth commented 6 years ago

I'm trying to get this plugin to load using the confluentinc/cp-kafka-connect docker image, but when I start connect-standalone I get an error, that I believe might be a jar version mismatch.

Stacktrace is below, and a sample Dockerfile that builds this plugin and try's to run connect-standalone but fails.

Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.collect.Sets$SetView.iterator()Lcom/google/common/collect/UnmodifiableIterator;
        at org.reflections.Reflections.expandSuperTypes(Reflections.java:380)
        at org.reflections.Reflections.<init>(Reflections.java:126)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanPluginPath(DelegatingClassLoader.java:258)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanUrlsAndAddPlugins(DelegatingClassLoader.java:201)
        at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initLoaders(DelegatingClassLoader.java:162)
        at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:47)
        at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:75)

Sample Dockerfile to build this plugin, and copy it to a new image based on the confluentinc/cp-kafka-connect docker image.

FROM openjdk:8-jdk as builder

RUN apt-get update ;\
    apt-get install -y maven

RUN git clone https://github.com/awslabs/kinesis-kafka-connector.git
RUN cd kinesis-kafka-connector && mvn package

FROM confluentinc/cp-kafka-connect
RUN mkdir -p /usr/share/java/kafka/kinesis-kafka-connector

# All the variations below fail to load the kinesis-kafka-connector plugin
#COPY --from=builder  /kinesis-kafka-connector/target/amazon-kinesis-kafka-connecter-0.0.9-SNAPSHOT.jar /usr/share/java/kafka/
#COPY --from=builder  /kinesis-kafka-connector/target /usr/share/java/amazon-kinesis-kafka/
#COPY --from=builder  /kinesis-kafka-connector/target /usr/lib/jvm/zulu-8-amd64/jre/lib/ext/kinesis-kafka-connector

# This variation leads to a NoSuchMethodError on startup, but kinesis seems to get found, and the class loader bails due to
# a probable guave version mismatch?
COPY --from=builder  /kinesis-kafka-connector/target/amazon-kinesis-kafka-connecter-0.0.9-SNAPSHOT.jar /usr/lib/jvm/zulu-8-amd64/jre/lib/ext

# Copy sample configs into new image
COPY --from=builder  /kinesis-kafka-connector/config/worker.properties \
                     /kinesis-kafka-connector/config/kinesis-firehose-kafka-connector.properties \
                     /kkc/
CMD /usr/bin/connect-standalone /kkc/worker.properties /kkc/kinesis-firehose-kafka-connector.properties
jevonearth commented 6 years ago

Hi @nehalmehta any chance you could have a quick look at this and offer some advice?

zhiyanliu commented 4 years ago

https://github.com/zhiyanliu/kinesis-kafka-connector-docker