I'm using the Play 2.5.3 framework, and for whatever reason Ebean seems to be failing while creating evolutions for my local (in memory) database. Here's the full stack trace.
[info] play.api.UnexpectedException: Unexpected exception[NoSuchMethodError: com.avaje.ebean.config.ServerConfig.getConstraintNaming()Lcom/avaje/ebean/config/DbConstraintNaming;]
[info] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:174)
[info] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(DevServerStart.scala:126)
[info] at scala.Option.map(Option.scala:146)
[info] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:126)
[info] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1$$anonfun$apply$1.apply(DevServerStart.scala:124)
[info] at scala.util.Success.flatMap(Try.scala:231)
[info] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:124)
[info] at play.core.server.DevServerStart$$anonfun$mainDev$1$$anon$1$$anonfun$get$1.apply(DevServerStart.scala:116)
[info] at scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24)
[info] at scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24)
[info] Caused by: java.lang.NoSuchMethodError: com.avaje.ebean.config.ServerConfig.getConstraintNaming()Lcom/avaje/ebean/config/DbConstraintNaming;
[info] at com.avaje.ebean.dbmigration.model.CurrentModel.<init>(CurrentModel.java:37)
[info] at play.db.ebean.EbeanDynamicEvolutions.generateEvolutionScript(EbeanDynamicEvolutions.java:91)
[info] at play.db.ebean.EbeanDynamicEvolutions.lambda$create$4(EbeanDynamicEvolutions.java:59)
[info] at play.db.ebean.EbeanDynamicEvolutions$$Lambda$33/1642038057.accept(Unknown Source)
[info] at java.util.HashMap.forEach(HashMap.java:1280)
[info] at play.db.ebean.EbeanDynamicEvolutions.create(EbeanDynamicEvolutions.java:58)
[info] at play.api.db.evolutions.ApplicationEvolutions.start(ApplicationEvolutions.scala:40)
[info] at play.api.db.evolutions.ApplicationEvolutions.<init>(ApplicationEvolutions.scala:150)
[info] at play.api.db.evolutions.ApplicationEvolutionsProvider.get$lzycompute(EvolutionsModule.scala:53)
[info] at play.api.db.evolutions.ApplicationEvolutionsProvider.get(EvolutionsModule.scala:53)
Googling this exception got me next to no information.
In my "application.conf" file,
ebean.default = ["models.*"]
db {
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
# https://www.playframework.com/documentation/latest/Developing-with-the-H2-Database
default.driver = org.h2.Driver
default.url = "jdbc:h2:mem:play"
default.username = sa
default.password = ""
# You can turn on SQL logging for any datasource
# https://www.playframework.com/documentation/latest/Highlights25#Logging-SQL-statements
#default.logSql=true
}
which seems to be what everyone else uses. My ebean.properties file, which I thought also may be the problem, simply contains
ebean.namingconvention=com.avaje.ebean.config.MatchingNamingConvention
My build.sbt file looks as follows:
name := """Project-CS2340"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
resolvers ++= Seq(
"webjars" at "http://webjars.github.com/m2"
)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs,
"org.webjars" %% "webjars-play" % "2.3.0",
"org.webjars" % "bootstrap" % "3.0.0" exclude("org.webjars", "jquery"),
"org.webjars" % "jquery" % "1.8.3",
"org.avaje.ebeanorm" % "avaje-ebeanorm" % "4.6.2"
)
playEbeanDebugLevel := 4
fork in run := true
Earlier today, the application worked without error, and I suppose I changed something and forgot about it while taking a break. No idea, honestly.
Replace the library dependency of ebean
in your build.sbt file
"org.avaje.ebeanorm" % "avaje-ebeanorm" % "4.6.2"
with the following
"org.avaje" % "ebean" % "2.7.3"
Have a good luck