Akka com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'enabled'

I am trying to get my akka cluster up and running on my localhost with below configuration. My language is Java.
It works all good in eclipse, however, it gives me an error when I build my fat jar and try to run it from the command line.
Error:
Caused by: com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'enabled'

I am pretty sure that it finds following conf file as I confirmed that any changes I do in the file take effect in next run.

My pom.xml entries:

     <dependency>
			<groupId>com.typesafe.akka</groupId>
			<artifactId>akka-actor_2.12</artifactId>
			<version>2.5.12</version>
		</dependency>
		<dependency>
			<groupId>com.typesafe.akka</groupId>
			<artifactId>akka-cluster_2.12</artifactId>
			<version>2.5.12</version>
		</dependency>

Below is my application.conf file

Master {
    
akka { 

  actor {
    provider = "cluster"
  }
  remote {
    maximum-payload-bytes = 30000000 bytes
    log-remote-lifecycle-events = off
    netty.tcp {
      hostname = "127.0.0.1"
      port = 0
      message-frame-size =  30000000b
      send-buffer-size =  30000000b
      receive-buffer-size =  30000000b
      maximum-frame-size = 30000000b
    }
  }

  cluster {
    roles = ["Master"] 
    seed-nodes = [
      "akka.tcp://GyanClusterSystem@127.0.0.1:2556"]
      

    # auto downing is NOT safe for production deployments.
    # you may want to use it during development, read more about it in the docs.
    #
    #auto-down-unreachable-after = 10s
  }
}
}

Worker {
akka { 
  actor {
    provider = "cluster"
  }
  remote {
    maximum-payload-bytes = 30000000 bytes
    log-remote-lifecycle-events = off
    netty.tcp {
      hostname = "127.0.0.1"
      port = 0
      message-frame-size =  30000000b
      send-buffer-size =  30000000b
      receive-buffer-size =  30000000b
      maximum-frame-size = 30000000b
    }
  }

  cluster {
    roles = ["Worker"]
    seed-nodes = [
      "akka.tcp://GyanClusterSystem@127.0.0.1:2556"]
      

    # auto downing is NOT safe for production deployments.
    # you may want to use it during development, read more about it in the docs.
    # auto-down-unreachable-after = 10s
  }
}
}

Please show more of your pom; are you building a far jar? Are you properly concating the reference.conf files?

See documentation about this: https://doc.akka.io/docs/akka/2.5.6/scala/general/configuration.html#when-using-jarjar-onejar-assembly-or-any-jar-bundler

Here is build section of my pom.xml

<build>
		<plugins>
			<!-- Maven Assembly Plugin -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.4.1</version>
				<configuration>
					<!-- get all project dependencies -->
					<descriptorRefs>
						<descriptorRef>jar-with-dependencies</descriptorRef>
					</descriptorRefs>
					<!-- MainClass in mainfest make a executable jar -->
					<archive>
						<manifest>
							<mainClass>io.gyan.GyanCrunchClusterCreator</mainClass>
						</manifest>
					</archive>

				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<!-- bind to the packaging phase -->
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>

		</plugins>
	</build>

Also, I have only one conf file. application.conf So I am guessing I don’t need any other reference.conf files?
Also, I guess I need to Maven Shade plug-in instead of Assembly?

For simplicity sake and testing purposes, I kept my application.conf file outside of my codebase for now. Please see below.

@Bean
	public ActorSystem actorSystem() {

		Config parsedConfig = ConfigFactory.parseFile(new File("/gyan/application.conf"));

		Config config = ConfigFactory
				.parseString(
						"akka.remote.netty.tcp.port=" + "2556" + "\n" + "akka.remote.artery.canonical.port=" + "2556")
				.withFallback(ConfigFactory.load(parsedConfig).getConfig("Master"));

		ActorSystem system = ActorSystem.create("GyanClusterSystem", config);

		SpringExtension.SPRING_EXTENSION_PROVIDER.get(system).initialize(applicationContext);
		return system;
	}

I tried with shade plugin as well, but no luck :pensive:

<build>
		<plugins>
		<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.0.2</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<version>3.1.1</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

Also, I have only one conf file. application.conf So I am guessing I don’t need any other reference.conf files?

You do have have tons of them actually :slightly_smiling_face:
Each akka-* library defines its own reference.conf, so they have to be merged using the shading as documented.

Please configure the plugin the as it is shown in the documentation – the things around reference.conf specifically. In the piece you pasted you did not configure it.

:slight_smile: Thanks, that worked. Finally, it’s up and running!