I need to create a Nutch plugin that communicate with some external applications using Akka. In order to do this, I need to package the plugin as a fat Jar - I am using sbt-assembly version 0.8.3.
When I try to run the plugin, I get the exception
com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka'
as if Akka was not able to find reference.conf
. This is weird, because sbt-assembly
should be able to package that file correctly, and in fact I can see its content in the created jar.
My build.sbt
looks like this:
import AssemblyKeys._
name := "my-project"
version := "0.1-SNAPSHOT"
scalaVersion := "2.10.0"
resolvers ++= Seq(
"Central Repo" at "http://repo1.maven.org/maven2",
"Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
"Akka io" at "http://akka.io/repository"
)
libraryDependencies ++= Seq(
...,
"com.typesafe.akka" %% "akka-actor" % "2.1.1",
"com.typesafe.akka" %% "akka-remote" % "2.1.1"
)
seq(assemblySettings: _*)
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case "plugin.xml" =>
MergeStrategy.first
case x if x startsWith "org/apache/jasper" =>
MergeStrategy.last
case x if x startsWith "javax/xml" =>
MergeStrategy.last
case x if x startsWith "javax/servlet" =>
MergeStrategy.last
case x if x startsWith "org/apache/commons" =>
MergeStrategy.last
case x if x startsWith "org/apache/xmlcommons" =>
MergeStrategy.last
case x if x startsWith "org/xml/sax" =>
MergeStrategy.last
case x if x startsWith "org/w3c/dom" =>
MergeStrategy.last
case x => old(x)
}
}
The last lines are needed to fix some conflicts between nutch and hadoop.
What is the correct way to package an Akka application?
When using JarJar, OneJar, Assembly or any jar-bundler
. I am not sure if it helps your case – IndigoLet it crash!
blog where this issue is discussed. In theory, the default configuration ofsbt-assembly' should merge the
reference.conf` files - in fact I can see the result of a merge in the jar. But it seems that whatever merge strategy I use, the keyakka
is missing, that is, the file reference.conf is not read at all. – Kurtreference.conf
that is located in theakka-actor
jar? – Indigoreference.conf
inakka-actor
and the one inakka-remote
. – Kurtakka.version
is missing; in your case it is onlyakka
) – Wooten