Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning akka within an SBT build task: reference configuration unexpectedly missing
    text
    copied!<p>I'm trying to run a rather simple HTTP POST request within a task I wrote for my SBT build, and seeing that SBT does not seem to have helpers for that, I settled on spray-client to accomplish this task.</p> <p>In a <code>project/dependencies.sbt</code> file I put the following: </p> <pre><code>resolvers += "spray.io repo" at "http://repo.spray.io/" libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-actor" % "2.2.3", "io.spray" % "spray-client" % "1.2.0") </code></pre> <p>And my task is implemented by:</p> <pre><code>def uploadSite(version: String, siteArchive: File, log: Logger): HttpResponse = { def request: HttpRequest = Post(siteUploadUrl, MultipartFormData(Map( // abridged )) implicit val system = ActorSystem() // &lt;-- Exception HERE! try { import system.dispatcher val future: Future[HttpResponse] = pipelining.sendReceive(request) Await.result(future, 1 minute) } finally system.shutdown() } </code></pre> <p>The task fails when I run it with the following exception:</p> <pre><code>com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka' at com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:115) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:138) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:150) at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:155) at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:197) at akka.actor.ActorSystem$Settings.&lt;init&gt;(ActorSystem.scala:136) at akka.actor.ActorSystemImpl.&lt;init&gt;(ActorSystem.scala:470) at akka.actor.ActorSystem$.apply(ActorSystem.scala:111) at akka.actor.ActorSystem$.apply(ActorSystem.scala:93) at akka.actor.ActorSystem$.apply(ActorSystem.scala:82) at MyIO$.uploadSite(MyIO.scala:65) </code></pre> <p>My basic analysis is that the <code>reference.conf</code> file that can be found in <code>akka-actor_2.10-2.2.3.jar</code> is not read, for some reason that escapes me and maybe has something to do with how SBT manages its classpath for running the build.</p> <p>Some precisions: I'm on SBT 0.13.0 (hence Scala 2.10 for the build code) and I've checked that the aforementioned akka-actor jar indeed contains a reference.conf file which is as expected. When looking at what I <em>guess</em> might be related to the build execution classpath (<code>reload plugins</code> then <code>show runtime:fullClasspath</code> in sbt), that jar appears in the list.</p> <p>I also failed at googling anything relevant, being unable to convey that the problem lies with running akka from <em>within an SBT build</em>.</p> <p>In the end, I really have no idea how the 'akka' configuration key could be missing. Can anyone help?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload