Hi Sergey,

I have micro-services that run as Java main and the passed command line 
parameter is where my config file is located,
I also fallback to an internal config (static.conf) which is part of a jar 
file, example below:

final Config config = ConfigFactory.parseFile(new File(args[0])).
withFallback(ConfigFactory.parseResources("static.conf")).resolve();

The resolve call is very important if you need to use variables and resolve 
the final values once all your configurations are parsed,
by parsed I mean syntactically, the final result is computed by the 
resolve() call.

HTH,

Guido.

On Wednesday, March 21, 2012 at 2:44:22 PM UTC, Sergey Malov wrote:
>
> I have external configuration file I'm trying to load before starting my 
> application, it is sourced inside the app as:
>         val conf = ConfigFactory.load("custom.conf");
>
> It has some updated akka {} settings (debug-related) and some application 
> specific settings. 
>
> I'm starting app as:
>         java -Dconfig.resource=<path>/custom.conf -jar Application.jar
>
> I tried relative <path>, absolute <path> - nothing works, I'm getting 
> error:
>
> Exception in thread "main" com.typesafe.config.ConfigException$Missing: No 
> configuration setting found for key 'akka.version'
>         at 
> com.typesafe.config.impl.SimpleConfig.findKey(SimpleConfig.java:115)
>         at 
> com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:135)
>         at 
> com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:140)
>         at 
> com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:108)
>         at 
> com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:146)
>         at 
> com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:188)
>         at akka.actor.ActorSystem$Settings.<init>(ActorSystem.scala:116)
>         at akka.actor.ActorSystemImpl.<init>(ActorSystem.scala:424)
>         at akka.actor.ActorSystem$.apply(ActorSystem.scala:103)
>         at akka.actor.ActorSystem$.apply(ActorSystem.scala:89)
>         at 
> com.mdialog.linear_stream_manager.LinearStreamManager$delayedInit$body.apply(App.scala:9)
>         at scala.Function0$class.apply$mcV$sp(Function0.scala:34)
>         at 
> scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
>         at scala.App$$anonfun$main$1.apply(App.scala:60)
>         at scala.App$$anonfun$main$1.apply(App.scala:60)
>         at 
> scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
>         at scala.collection.immutable.List.foreach(List.scala:45)
>         at 
> scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:30)
>         at scala.App$class.main(App.scala:60)
>         at 
> com.mdialog.linear_stream_manager.LinearStreamManager$.main(App.scala:7)
>         at 
> com.mdialog.linear_stream_manager.LinearStreamManager.main(App.scala)
>
>
> Anything I'm doing incorrectly ?
>
> Thanks,
>
> Sergey 
>
>
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to