Support Questions

Find answers, ask questions, and share your expertise

Kafka Connect : Not starting in STANDALONE Mode

avatar
Contributor

Issue : Kafka Connect is not starting in STANDALONE mode in HDP 2.5.6 development cluster. Below are the steps I've followed.

Description : Before that, I'd like to tell you that normal publishing/consuming are working with kafka topics. I've tested it fully.

Now, lets begin. Main objective of this activity is to create a ETL data pipeline using Kafka Connect API like, we need to start Kafka Connect (in STANDALONE mode) to look a file, push new data into Kafka Topic and then sink into another file.

As simple as that. Below are the steps I've followed.

Step 1: Creating a properties file to configure source - a file.

fsbappdev@DG1357> vi /home/fsbappdev/gnans/kafka_connect_source_file.properties
fsbappdev@DG1357> cat /home/fsbappdev/gnans/kafka_connect_source_file.properties
name=local-file-source
connector.class=FileStreamSource
tasks.max=1
file=/home/fsbappdev/gnans/kafka_connect_source_file.txt
topic=credit_risk_topic

Setup 2 : Creating a properties file to configure sink - a file

fsbappdev@DG1357> vi /home/fsbappdev/gnans/kafka_connect_sink_file.properties
fsbappdev@DG1357> cat /home/fsbappdev/gnans/kafka_connect_sink_file.properties
name=local-file-sink
connector.class=FileStreamSink
tasks.max=1
file=/home/fsbappdev/gnans/kafka_connect_sink_file.txt
topics=credit_risk_topic

Step 3: Creating a properties file to start Kafka Connect in Standalone mode.

fsbappdev@DG1357> cat /home/fsbappdev/gnans/kafka_connect_standalone.properties
bootstrap.servers=dg1358:6667
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
key.converter.schemas.enable=true
value.converter.schemas.enable=true
internal.key.converter=org.apache.kafka.connect.storage.StringConverter
internal.value.converter=org.apache.kafka.connect.storage.StringConverter
offset.storage.file.filename=/home/fsbappdev/gnans/kafka_connect.offsets

Step 4: Starting Kafka Connect (in Standalone Mode) using the list of properties file which I've created in above steps.

sh connect-standalone.sh /home/fsbappdev/gnans/kafka_connect_standalone.properties /home/fsbappdev/gnans/kafka_connect_source_file.properties /home/fsbappdev/gnans/kafka_connect_sink_file.properties

Error Stacktrace:

Upon executing the above command, i encounter the below error:

[2018-04-30 19:08:53,240] WARN FAILED o.e.j.s.ServletContextHandler@229f66ed{/,null,STARTING}: java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; (org.eclipse.jetty.util.component.AbstractLifeCycle:212)
java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map;
        at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:331)
        at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177)
        at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369)
        at javax.servlet.GenericServlet.init(GenericServlet.java:241)
        at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:616)
        at org.eclipse.jetty.servlet.ServletHolder.initialize(ServletHolder.java:396)
        at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:871)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.handler.StatisticsHandler.doStart(StatisticsHandler.java:232)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:387)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:354)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.apache.kafka.connect.runtime.rest.RestServer.start(RestServer.java:145)
        at org.apache.kafka.connect.runtime.Connect.start(Connect.java:56)
        at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:82)

Though it looks likes a WARN, its failure. I see last few lines of console as follows:

[2018-04-30 19:08:53,253] INFO Kafka Connect stopping (org.apache.kafka.connect.runtime.Connect:68)
[2018-04-30 19:08:53,253] INFO Stopping REST server (org.apache.kafka.connect.runtime.rest.RestServer:154)
[2018-04-30 19:08:53,257] INFO Stopped ServerConnector@ba2f4ec{HTTP/1.1}{0.0.0.0:8083} (org.eclipse.jetty.server.ServerConnector:306)
[2018-04-30 19:08:53,259] INFO Stopped o.e.j.s.ServletContextHandler@229f66ed{/,null,UNAVAILABLE} (org.eclipse.jetty.server.handler.ContextHandler:865)
[2018-04-30 19:08:53,259] INFO REST server stopped (org.apache.kafka.connect.runtime.rest.RestServer:165)
[2018-04-30 19:08:53,260] INFO Herder stopping (org.apache.kafka.connect.runtime.standalone.StandaloneHerder:77)
[2018-04-30 19:08:53,260] INFO Worker stopping (org.apache.kafka.connect.runtime.Worker:128)
[2018-04-30 19:08:53,260] WARN Shutting down tasks [] uncleanly; herder should have shut down tasks before the Worker is stopped. (org.apache.kafka.connect.runtime.Worker:141)
[2018-04-30 19:08:53,260] INFO Stopped FileOffsetBackingStore (org.apache.kafka.connect.storage.FileOffsetBackingStore:68)
[2018-04-30 19:08:53,260] INFO Worker stopped (org.apache.kafka.connect.runtime.Worker:151)
[2018-04-30 19:08:56,964] INFO Reflections took 3837 ms to scan 109 urls, producing 6344 keys and 39164 values  (org.reflections.Reflections:229)
[2018-04-30 19:08:56,974] INFO Herder stopped (org.apache.kafka.connect.runtime.standalone.StandaloneHerder:91)
[2018-04-30 19:08:56,974] INFO Kafka Connect stopped (org.apache.kafka.connect.runtime.Connect:73)
fsbappdev@DG1357:/usr/hdp/current/kafka-broker/bin>

To me, it looks like it is due to jar files compatibility. But, I dont know which jar would suit well among them. My Hadoop/Kafka Cluster is being managed by another team and I need to give them some advice to fix it. Can anyone please help me on this?

Note : I've attached ( kafka-connect-filesource-filesink-errorlog-2.txt ) full error stacktrace in this question to get help.

1 REPLY 1

avatar
Explorer

Here's why: https://issues.apache.org/jira/browse/KAFKA-5089

Workaround/Hack:

Force Kafka COnnect libs like javax.ws.rs-api-2.0.1.jar to appear on the classpath first by exporting your CLASSPATH variable before running connect-standalone.sh

export CLASSPATH=/usr/hdp/2.6.4.0-91/kafka/libs/*