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
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Patrik Nordwall
Typesafe - The software stack for applications that scale
Twitter: @patriknw
Not sure if you figured this out already (I didn't see the thread
until now), but in case it helps someone coming along later,
On Wed, Mar 21, 2012 at 10:44 AM, Sergey Malov <sma...@mdialog.com> 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");
>
detailed docs are at
http://typesafehub.github.com/config/latest/api/com/typesafe/config/ConfigFactory.html
if necessary you could also refer to
https://github.com/typesafehub/config/blob/master/config/src/main/java/com/typesafe/config/ConfigFactory.java
though please let me know if the docs are missing important info.
The config.resource, config.file system properties only apply if you
are using load() with no arguments:
http://typesafehub.github.com/config/latest/api/com/typesafe/config/ConfigFactory.html#load%28%29
If you specify a filename like custom.conf, then it is loaded
unconditionally and those system properties are not used.
> Exception in thread "main" com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka.version'
What this error means (most likely) is that "reference.conf" from the
Akka jar is not in the Config that you're providing to the
ActorSystem.
If you get desperate, in the latest version of the config lib you can
do "-Dconfig.trace=loads" and it will log each config file loaded to
stderr. To enable this you would have to patch and rebuild Akka, with
the patch at https://github.com/akka/akka/pull/375 which is a fairly
major undertaking. It's probably easier to make some simple test code
showing how you load your config here for us to debug, as Patrik says.
I don't think it's possible to use any flavor of ConfigFactory.load()
without getting reference.conf, assuming that the akka jar is on your
classpath, so my guess is that your problem is not related to the
custom.conf filename?
Does the following (untested) program work for you?
object TestApp extends App {
val conf = ConfigFactory.load()
val system = ActorSystem("MySystem", conf")
// maybe start some actor here , not sure if you need to
system.awaitTermination()
}
If that program works, can you modify it to be more like your real
program until it breaks, then send us the resulting test case?
Havoc
/Patrik
> reference.conf:
> UAT:
> akka
> myproject
> Production:
> akka
> myproject
I don't understand your notation here;
- do you mean you have one reference.conf with sections
uat{ akka{} myproject{} } production{ akka{} myproject{} }
or do you mean you have four reference.conf?
- why do you have a reference.conf at all for akka? reference.conf
are the "factory defaults",
you should be able to put everything in application.conf
> Reading the documentation, I did every System.setProperty imaginable,
> but nothing worked.
Note that the system properties are cached the first time any config
is loaded. So System.setProperty will only work if you do it before
any config is ever loaded. However there shouldn't be a need to
System.setProperty because in code you can just use a different
ConfigFactory static method and load the config that way. The property
is only needed to avoid writing code.
Can you explain more what problem you are having, though? What error
do you see and what are you expecting?
Can you make the short test case I described in the email you quoted,
showing the problem? It isn't clear enough to me what you or the
original poster are doing in your code so it's hard to give
suggestions.
Havoc
I'm looking to load an external config file as well. I did not have any lucky adding an external config directory to my classpath. If I use -Dconfig.file=/path/to/file.conf, then it reads the file, but it seems this becomes the only configuration file it uses. I want to maintain resources/application.conf and have an additional external config file. That way I can fallback to application.conf with some stuff the user doesn't care to think about when they configure the application. Is there anything I'm missing?
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/zWbnPAYmyMIJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
I'm looking to load an external config file as well. I did not have any lucky adding an external config directory to my classpath. If I use -Dconfig.file=/path/to/file.conf, then it reads the file, but it seems this becomes the only configuration file it uses. I want to maintain resources/application.conf and have an additional external config file. That way I can fallback to application.conf with some stuff the user doesn't care to think about when they configure the application.
Is there anything I'm missing?
--
At the top of /path/to/file.conf, add the line
include "application.conf"
Then anything after that line will override application.conf. Or if
you want file.conf stuff to be overridden by application.conf, put the
include at the bottom instead of the top.
As Patrik says if you are making a library and just defining default
settings, the intended approach is to create a reference.conf
In future versions (not in Akka 2.0) there's some more flexibility
with include statements, which may also be useful:
https://github.com/typesafehub/config/blob/master/NEWS.md
Havoc
On Mon, Apr 23, 2012 at 8:52 PM, bradford <finge...@gmail.com> wrote:
> Was I mistaken, though, to expect Akka to pickup up the config file in the
> directory that I manually added to the classpath?
>
-Dconfig.file specifies an alternative to application.conf, so if you
specify -Dconfig.file, there's no attempt to load any application.conf
unless you include it yourself.
But reference.conf is loaded in both cases.
The "Standard behavior" section in
https://github.com/typesafehub/config/blob/master/README.md goes into
some detail.
Havoc
--
>>>>>>>>>> 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+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
--
>>>>>>>>>> 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+unsubscribe@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
final Config config = ConfigFactory.parseFile(new File(args[0])).withFallback(ConfigFactory.parseResources("static.conf")).resolve();