No configuration setting found for key 'akka.version'

坚强是说给别人听的谎言 提交于 2019-11-27 04:29:25
Zoltán

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

Jan-Terje Sørensen

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>

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!

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!