Repository navigation
Build production failing if I have application.properties configuration #212
Copy link
Copy link
Closed
Description
I don't have this issue with another plugin: https://github.com/payintech/play-ebean and it is working fine, except that plugin got an issue (payintech#15) that making me try this one and this not working as well with different kind of issues.
I got the following application.properties inside conf folder:
#https://github.com/ebean-orm/ebean/blob/master/CONFIGURATION.md
ebean.default.databasePlatformName=sqlserver17
ebean.default.idType=IDENTITY
ebean.default.allQuotedIdentifiers=true
When I try to do production build I get the following issue:
[info] Done compiling.
[error] java.lang.RuntimeException: com.typesafe.config.ConfigException$WrongType: application.properties @ file:/app/conf/application.properties: default has type OBJECT rather than LIST
[error] at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:163)
[error] at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:174)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:188)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:193)
[error] at com.typesafe.config.impl.SimpleConfig.getList(SimpleConfig.java:262)
[error] at com.typesafe.config.impl.SimpleConfig.getHomogeneousUnwrappedList(SimpleConfig.java:348)
[error] at com.typesafe.config.impl.SimpleConfig.getStringList(SimpleConfig.java:406)
[error] at play.db.ebean.EbeanParsedConfig.lambda$parseFromConfig$0(EbeanParsedConfig.java:58)
[error] at java.base/java.util.Map.forEach(Map.java:661)
[error] at play.db.ebean.EbeanParsedConfig.parseFromConfig(EbeanParsedConfig.java:52)
[error] at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:29)
[error] at play.db.ebean.ModelsConfigLoader.apply(ModelsConfigLoader.java:22)
[error] at play.ebean.sbt.PlayEbean$.$anonfun$configuredEbeanModels$4(PlayEbean.scala:149)
[error] at play.ebean.sbt.PlayEbean$.withClassLoader$1(PlayEbean.scala:126)
[error] at play.ebean.sbt.PlayEbean$.$anonfun$configuredEbeanModels$1(PlayEbean.scala:146)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:281)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19)
[error] at sbt.Execute.work(Execute.scala:290)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:281)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:834)
[error] (Compile / playEbeanModels) com.typesafe.config.ConfigException$WrongType: application.properties @ file:/app/conf/application.properties: default has type OBJECT rather than LIST
[error] Total time: 43 s, completed Feb 17, 2021, 10:09:04 AM
The command '/bin/sh -c sbt clean update compile dist' returned a non-zero code: 1What exactly this problem, it is not saying what exactly the broken config key that expecting LIST!
I'm using version 6.0.0:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "6.0.0")
Metadata
Metadata
Assignees
Labels
No labels
Activity
mkurz commentedon Jan 28, 2022
@almothafar I just released play-ebean 6.2.0-RC4, please have a look at the release notes how to upgrade: https://github.com/playframework/play-ebean/releases/tag/6.2.0-RC4. Please let me know if this problem you reported here is fixed with that release, thanks!
mkurz commentedon Mar 6, 2023
The problem here is that the typesafe config loads
conf/application.propertieson top of application.conf, meaning Play's app config will also contain all theebean.*configs (databasePlatformName,idType,...). But theapplication.propertiesfile here is only meant for ebean, not for Play... As long as ebean's config was calledebean.properties(which is deprecated) there was no problem of course because typesafe config doesn't care about such a file. But now when it loads the application.properties it tries to iterate over theebean.*keys which then fails:play-ebean/play-ebean/src/main/java/play/db/ebean/EbeanParsedConfig.java
Lines 43 to 65 in 6e70610
The immediate solution is to just use (and recommend)
application.yamlinstead ofapplication.properties: https://ebean.io/docs/intro/configuration/Long term we coud just switch Play's default ebean config key to be
play.ebeaninstead of justebean:play-ebean/play-ebean/src/main/resources/reference.conf
Line 8 in 6e70610
mkurz commentedon Oct 8, 2026
This got fixed by
8.x, [7.x] Ignore Ebean settings below ebean.* that are no lists of models #908 for7.x),which will be part of the next releases. Here's what was going on, and how to configure this:
Cause
Besides
conf/application.conf, Play also loadsconf/application.propertiesinto its configuration. That's the same file Ebean reads its own settings from (Ebean doesn't readapplication.conf). Play Ebean reads the lists of models fromebean.<server>in Play's configuration, and took every entry belowebean.for such a list. So with theapplication.propertiesabove,ebean.defaultwas an object (databasePlatformName,idType,allQuotedIdentifiers) instead of a list of models, and Play Ebean failed withdefault has type OBJECT rather than LIST. That happened in the sbt plugin when loading the models to enhance, as in the stack trace above, and at runtime as well. Global Ebean settings likeebean.migration.run=falsehad the same effect.What changed
Play Ebean now only uses strings and lists below
ebean.as lists of models, and ignores everything else, like theseebean.default.*settings.How to configure it
Keep the list of models in
conf/application.conf:and Ebean's own settings in
conf/application.properties:In Play's configuration,
application.conftakes precedence overapplication.properties, so Play Ebean gets the list of models from there, while Ebean reads its settings fromapplication.propertiesitself.Even better, use
conf/application.yamlfor Ebean's settings, which only Ebean reads, so they don't end up in Play's configuration at all. That's also the place for settings directly belowebean., likeebean.dumpMetricsOnShutdown=true: as all values inapplication.propertiesare strings, Play Ebean takes such a setting for a list of models, of an Ebean server without a database, which it then skips.With older releases, you can avoid the collision by moving Play Ebean's lists of models to a different key:
The docs now explain where Ebean's own settings go.