title: WARN org.apache.kafka.clients.NetworkClient - [Producer clientId=producer-1] Bootstrap broker 127.0.0.1:9092 (id: -1 rack: null) disconnected
body: <p>I am trying to make Kafka producer using java program. but when I run program I got some warnings, there is no any error but producer is not sending data and <strong>warning is like below.</strong></p>
  <pre><code>[kafka-producer-network-thread | producer-1] WARN org.apache.kafka.clients.NetworkClient - [Producer clientId=producer-1] Bootstrap broker 127.0.0.1:9092 (id: -1 rack: null) disconnected
  
  [kafka-producer-network-thread | producer-1] WARN org.apache.kafka.clients.NetworkClient - [Producer clientId=producer-1] Connection to node -1 (/127.0.0.1:9092) could not be established. Broker may not be available.
  </code></pre>
  <p><strong>POM.XML file</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;
           xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
           xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;org.example&lt;/groupId&gt;
      &lt;artifactId&gt;KafkaProject&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.kafka&lt;/groupId&gt;
              &lt;artifactId&gt;kafka-clients&lt;/artifactId&gt;
              &lt;version&gt;2.6.0&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
              &lt;version&gt;1.7.30&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  <p><strong>First_producer.java File</strong></p>
  <pre><code>package Kafka;
  
  import org.apache.kafka.clients.producer.KafkaProducer;
  import org.apache.kafka.clients.producer.ProducerConfig;
  import org.apache.kafka.clients.producer.ProducerRecord;
  import org.apache.kafka.common.serialization.StringSerializer;
  
  import java.util.Properties;
  
  public class First_Producer {
      public static void main(String[] args) {
  
  
          String bootstrapServer = &quot;127.0.0.1:9092&quot;;
  
          //create producer properties
          Properties properties = new Properties();
          properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,bootstrapServer);
          properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
          properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG,StringSerializer.class.getName());
  
          //create the producer
          KafkaProducer&lt;String, String&gt; producer= new KafkaProducer&lt;String,String&gt;(properties);
  
          //create a producer record
          ProducerRecord&lt;String, String&gt;  record = new ProducerRecord&lt;String,String&gt;(&quot;first_topic&quot;,&quot;hello_world&quot;);
  
          //send data
          producer.send(record);
          producer.flush();
          producer.close();
  
      }
  }
  
  
  </code></pre>
  <p><strong>Consumer Command in Shell</strong></p>
  <pre><code>kafka-console-consumer --bootstrap-server 127.0.0.1:9092 --topic first_topic --group my-first-app
  
  </code></pre>
  <p>So can anyone assist me to solve this problem???</p>