title: Akka Stream Kafka: No configuration setting found for key 'kafka-clients'
body: <p>I'm trying to create a simple prototype using <a href="https://doc.akka.io/docs/akka-stream-kafka/current/home.html" rel="nofollow noreferrer">Alpakka Kafka connector (Akka Stream Kafka)</a>.</p>
  
  <p>When running the application I get the following error:</p>
  
  <pre><code>com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'kafka-clients'
  </code></pre>
  
  <p>I have the following code in <code>./src/main/scala/App.scala</code>:</p>
  
  <pre><code>import akka.Done
  import akka.actor.ActorSystem
  import akka.kafka.ProducerSettings
  import akka.kafka.scaladsl.Producer
  import akka.stream.{ActorMaterializer, Materializer}
  import akka.stream.scaladsl.Source
  import com.typesafe.config.ConfigFactory
  import org.apache.kafka.clients.producer.ProducerRecord
  import org.apache.kafka.common.serialization.StringSerializer
  
  import scala.concurrent.Future
  
  object App {
    def main(args: Array[String]): Unit = {
      println("Hello from producer")
  
      implicit val system = ActorSystem("fakeProducer")
      implicit val materializer: Materializer = ActorMaterializer()
  
      val config = system.settings.config // ConfigFactory.load()
  
      val producerSettings =
        ProducerSettings(config, new StringSerializer, new StringSerializer)
        .withBootstrapServers("localhost:9092")
  
      val done: Future[Done] =
        Source(1 to 100)
          .map(_.toString)
          .map(value =&gt; new ProducerRecord[String, String]("test-basic-numbers", value))
          .runWith(Producer.plainSink(producerSettings))
  
  
      println("Done")
    }
  }
  </code></pre>
  
  <p>The following <code>build.sbt</code>:</p>
  
  <pre><code>name := "test-akka-stream"
  
  version := "0.1"
  
  scalaVersion := "2.11.8"
  
  libraryDependencies += "com.typesafe.akka" %% "akka-stream-kafka" % "0.21.1"
  </code></pre>
  
  <p>I run the app using <code>sbt run</code>. I have not configured any uber/assembly jar.</p>
  
  <p>I'm probably missing something obvious but I cannot see it ... I suspect there is some problem with akka dependencies.</p>
  
  <h2>UPDATE</h2>
  
  <p>As suggested by @terminally-chill calling <code>ProducerSettings(system, new StringSerializer, new StringSerializer)</code> (passing <code>ActorSystem</code> instead of a configuration) solve the problem. I just don't understand if this is by design or a bug.</p>
  
  <h2>UPDATE 2</h2>
  
  <p>I have create a <a href="https://github.com/akka/alpakka-kafka/issues/515" rel="nofollow noreferrer">github issue</a> that is already been fixed. Now documentation is more accurate and explain the correct way to create the <code>ProducerSettings</code>/<code>ConsumerSettings</code>.</p>
  
  <pre><code>val config = system.settings.config.getConfig("akka.kafka.producer")
  val producerSettings =
        ProducerSettings(config, new StringSerializer, new StringSerializer)
        .withBootstrapServers("localhost:9092")
  </code></pre>
  
  <p>or you can pass the <code>ActorSystem</code> as explained above.</p>