Graalvm native-image for a scala app: No configuration setting found for key 'myapp'

Viewed 196

I am building a native image for a Scala app that uses SimpleConfig.

When I run the native image, I get this error message:

> ./myapp
Exception in thread "main" com.typesafe.config.ConfigException$Missing: system properties: No configuration setting found for key 'eqwalizer'
    at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:157)
    at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
    at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
    at com.typesafe.config.impl.SimpleConfig.getObject(SimpleConfig.java:269)
    at com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:275)
    at com.typesafe.config.impl.SimpleConfig.getConfig(SimpleConfig.java:42)
    at com.myapp.package$.config$lzycompute(package.scala:20)
    at com.myapp.package$.config(package.scala:19)
    at com.myapp.Main$.main(Main.scala:15)
    at com.myapp.Main.main(Main.scala)

Is there something I have to do to embed a config file in the native image?

I do not know very much about JVM stuff and no idea what aspects of this problem are to do with sbt vs. jvm vs. graalvm vs. properties files etc.

I get this error regardless of how I build the native image:

1 Answers

include the resource using this command line flag:

-H:IncludeResources='application.conf'

The flag accepts a java regex

Related