François
François

Reputation: 31

Ebean configuration in play 2.4.2 java?

I'm a beginner using DI and I have some ptoblems to migrate my apps from play java 2.3 to 2.4.2.

Btw it would be great to have some templates adapted to play java 2.4.x like the computer base application.

When I create a totally new application, I don't success to have the Play Ebean plugin working.

As indicating I add: the Play Ebean plugin tin project/plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")

then in build.sbt:

lazy val myProject = (project in file(".")).enablePlugins(PlayJava, PlayEbean)

and in application.conf:

ebean.default = ["models.*"]

the default database is postgresql

it compiles but when I run the application I obtain the following error:

Error in custom provider, Configuration error: Configuration error[null]
  while locating play.db.ebean.DefaultEbeanConfig$EbeanConfigParser
  at play.db.ebean.EbeanModule.bindings(EbeanModule.java:24):
Binding(interface play.db.ebean.EbeanConfig to
ProviderConstructionTarget(class
play.db.ebean.DefaultEbeanConfig$EbeanConfigParser) eagerly) (via
modules: com.google.inject.util.Modules$OverrideModule ->
play.api.inject.guice.GuiceableModuleConversions$$anon$1)
  while locating play.db.ebean.EbeanConfig
    for parameter 0 at
play.db.ebean.EbeanDynamicEvolutions.<init>(EbeanDynamicEvolutions.java:36)
....
Caused by: Configuration error: Configuration error[null]
......
Caused by: java.lang.NullPointerException at play.db.ebean.DefaultEbeanConfig$EbeanConfigParser.parse(DefaultEbeanConfig.java:79)

The complete trace is exactly this one: http://pastebin.com/7DtjSPFA

whatt is wrong? Does it need more configuration ?

thanks for your help.

Upvotes: 2

Views: 3441

Answers (2)

Fran&#231;ois
Fran&#231;ois

Reputation: 31

Thanks for your response. Finally I resolved it, the problem was in the database connection configuration in conf/application.conf:

db.default.driver=org.postgresql.Driver
db.default.url="jdbc:postgresql://localhost:5432/mydb"
db.default.username="user"
db.default.password="password"

my bad, I modified it when I configured the connection pool HikariCP (play.db.prototype.driver, etc ...), so the database connection was working but not with Ebean.

Upvotes: 1

BatteryAcid
BatteryAcid

Reputation: 8901

If you were using Guice, make sure to remove the libraryDependencies for it in your project's build.sbt file. If you were migrating from 2.3 to 2.4, Play now comes with Guice out-of-the-box: Play Framework Migration Guide - DI

For Play Framework 2.4, Remove this from build.sbt:

"com.google.inject" % "guice" % "3.0"

Upvotes: 0

Related Questions