jhipster warn org.apache.kafka.clients.NetworkClient Broker may not be available

Viewed 495

So I made a helloworld jhipster application and everything seems to be working fine but I'm getting this warning about every 3 seconds and it's clouding up my output:

WARN 542 --- [ad | producer-1] org.apache.kafka.clients.NetworkClient   : [Producer clientId=producer-1] Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.

Anybody know what's causing this? It's apparently not critical because everything seems to be working but it is quite aggravating, since I have to scroll way up in the terminal to find any actually relevant output, like for example what port the application is running on.

1 Answers

It looks like you selected the option to use Apache Kafka when you generated your project. Using Kafka is completely optional and requires a few extra steps as described in the official documentation (Using Kafka).

If this is just a "Hello World" app your best option is probably to just regenerate the project without Kafka. Otherwise, you will have to follow the steps in the documentation I linked above.

Basic instructions to use Kafka

  1. Install Docker Desktop if you don't have it already.
  2. Restart your computer as requested, and remember to enable hardware virtualization in your BIOS if you have it disabled.
  3. Navigate to the root folder of your project (where your /src/ folder is) and execute docker-compose -f src/main/docker/kafka.yml up -d
  4. Wait for the process to complete.
  5. Add .antMatchers("/api/<appName>-kafka/publish").permitAll() to your SecurityConfiguration.java where <appName> is the name you gave while generating your project. Note that you must add this line before .antMatchers("/api/**").authenticated().
  6. Now you can launch your application.

At this point everything is configured, so the 'Broker may not be available' messages should be gone.

Related