I am learning akka-remoting and this is how my project looks
The project structure looks like
project/pom.xml
project/mymodule/pom.xml
project/mymo
I tried this plugin, it is great but leads to another error due to some signed jars. Here is the error:
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
What I would suggest you to use is the spring boot maven plugin. Just add it to your build and enjoy seamless runnable jars. This is one good reason why I love Spring framework.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>final</classifier>
<mainClass>
com.main.PopularHashTags
</mainClass>
</configuration>
</execution>
</executions>
</plugin>
Note: You don't need to have a Spring Boot application to use this plugin. Just use it in any application and it works as a charm.
Adding AppendingTransformer alone didn't resolve the issue for me. If you are trying to deploy your spark application on EMR and are still facing this issue then please take a look at my solution here. Hope it helps!
So the problem generates while making a fat jar but not handling reference.conf the right way.
The explanation follows from @Zoltan's answer:
It seems that your problem is bundling into a jar-with-dependencies, which causes problems with Akka, as described in the documentation:
Warning
Akka's configuration approach relies heavily on the notion of every module/jar having its own reference.conf file, all of these will be discovered by the configuration and loaded. Unfortunately this also means that if you put/merge multiple jars into the same jar, you need to merge all the reference.confs as well. Otherwise all defaults will be lost and Akka will not function.
I have a solution for SBT users which doesn't require a plugin.
In build.sbt, add case "reference.conf" => MergeStrategy.concat to your module assembly configuration.
lazy val module_name = (project in file("module_path"))
.settings(
name := "module_name",
commonSettings,
assemblyJarName in assembly := "module_name.jar",
test in assembly := {},
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
#################### The line which needs to be added ###################
case "reference.conf" => MergeStrategy.concat
case _ => MergeStrategy.first
}
)
.dependsOn(other_modules, other_modules2)
The command MergeStrategy.concat literally functions the same way. While assembling whenever it encounters reference.conf it concatenates it to instead of creating a separate file for each akka module (which is the default behaviour).
Someone experienced on working with maven(pom.xml), please! extend this answer.
Had a similar issue:
com.typesafe.config.ConfigException$Missing:
No configuration setting found for key 'akka.persistence.journal-plugin-fallback'
Solved it with adding an appending transformer:
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
It seems that your problem is bundling into a jar-with-dependencies, which causes problems with Akka, as described in the documentation:
Warning
Akka's configuration approach relies heavily on the notion of every module/jar having its own reference.conf file, all of these will be discovered by the configuration and loaded. Unfortunately this also means that if you put/merge multiple jars into the same jar, you need to merge all the reference.confs as well. Otherwise all defaults will be lost and Akka will not function.
As suggested on the same page, you can use maven-shade-plugin to merge all the reference configurations:
If you are using Maven to package your application, you can also make use of the Apache Maven Shade Plugin support for Resource Transformers to merge all the reference.confs on the build classpath into one.
See also: Akka: missing akka.version