-1

I have an MQTT broker and Kafka broker running on ubuntu. I can publish messages to Kafka console consumers through producers. However, when I try to publish a message on Kafka through connector by this repository https://github.com/SINTEF-9012/kafka-mqtt-source-connector in standalone mode, this throws the following error:

error at sintef .

These are the configuration for

  1. connect-standalone.properties file:

connect-standalone.properties

  1. source connector.properties file:

mqtt-kakfa-connector

Please help me in connecting mosquitto to Kafka.

Richard Wilson
  • 297
  • 4
  • 17
habib
  • 1
  • 1
  • 1
    Please do not post images of text, they are hard to read and impossible for users of screen readers. Post the actual text and use the toolbar to format it. – hardillb Aug 11 '21 at 19:19

1 Answers1

0

The error indicates that this dependendency declared in the POM is not part of the JAR that you've put in the plugin path

    <dependency>
        <groupId>org.apache.logging.log4j</groupId>
        <artifactId>log4j-api</artifactId>
        <version>2.10.0</version>
    </dependency>

Looking at the logs, it seems to have used the SNAPSHOT jar file, not the with-dependencies one

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • I tried adding jar file _with-dependencies_ and then restarted both brokers. When the command _mosquitto_pub -h 127.0.0.1 -p 1883 -t test -m "Hey" _, it give me an error at MQTTSourceConnectorTask. **ERROR MqttSourceConnectorTask org.bson.json.JsonParseException: JsonReader was expecting a value but found 'hey' ** – habib Aug 12 '21 at 06:12
  • 1
    Error seems self-descriptive. You sent `-m "Hey"`, but you have `value.converter` expecting JSON, not plain strings. For example, try `-m '{"msg":"Hey"}'` – OneCricketeer Aug 12 '21 at 14:03
  • Hey, thanks for your timely response. I tried this too but it gives me same error. Any advice what I am missing ? – habib Aug 13 '21 at 02:58
  • I don't think you should get the exact same error containing `but found 'hey'` in that case. I have no experience with this connector to really answer further. If changing to StringConverter doesn't work, then I suggest opening a github issue or trying to [set up a debugger](https://stackoverflow.com/questions/45717658/what-is-a-simple-effective-way-to-debug-custom-kafka-connectors) with the source code – OneCricketeer Aug 13 '21 at 13:41
  • And if you did look at the github issues, you'd notice at least one person says it doesn't work, and looking at the source code, I definitely agree with them. Specifically, you're not sending data with at least 21 `/` characters to split on... I suggest finding a different connector such as the Confluent one, or https://github.com/johanvandevenne/kafka-connect-mqtt – OneCricketeer Aug 13 '21 at 13:55
  • 1
    I tried evokly connector as I had to use in standalone mode. Thanks for the reply. – habib Oct 04 '21 at 07:35