Geheimnisvolles Spiel 2.4 Injektion Ausnahme
Kürzlich aktualisiert, um zu Spielen 2.4 und ich bin immer noch lernen, all die kleinen Macken und so. Ich versuche gerade meine index-Seite funktioniert und ich habe eine harte Zeit, und ich weiß, es ist etwas kleines fehlt mir. Hier ist der Fehler
CreationException: Unable to create injector, see the following errors:
1) Error in custom provider, Configuration error: Configuration error[Cannot connect to database [default]]
while locating play.api.db.DBApiProvider
while locating play.api.db.DBApi
for parameter 0 at play.db.DefaultDBApi.<init>(DefaultDBApi.java:28)
at play.db.DefaultDBApi.class(DefaultDBApi.java:28)
while locating play.db.DefaultDBApi
while locating play.db.DBApi
for field at play.db.DBModule$NamedDatabaseProvider.dbApi(DBModule.java:61)
while locating play.db.DBModule$NamedDatabaseProvider
at com.google.inject.util.Providers$GuicifiedProviderWithDependencies.initialize(Providers.java:149)
at play.db.DBModule.bindings(DBModule.java:40):
Und meine Konfiguration Informationen (ja, die Portnummer für mysql ist korrekt)
Anwendung.conf
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql:localhost:33060/coffee_bean"
db.default.username=
db.default.password=""
ebean.default = ["models.*"]
Haupt-controller
public Result index() {
ObjectNode response = Json.newObject();
Configuration config = Play.application().configuration();
response.put(config.getString("coffee.bean.message.key"),config.getString("coffee.bean.success.message"));
response.put(config.getString("version"), config.getString("coffee.bean.version"));
return ok(response);
}
gebaut.sbt
name := """coffee-bean"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.6"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs,
"mysql" % "mysql-connector-java" % "5.1.36",
evolutions
)
//Play provides two styles of routers, one expects its actions to be injected, the
//other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator
lazy val myProject = (project in file("."))
.enablePlugins(PlayJava, PlayEbean)
plugins.sbt
//The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.2")
//Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
//Play enhancer - this automatically generates getters/setters for public fields
//and rewrites accessors of these fields to use the getters/setters. Remove this
//plugin if you prefer not to have this feature, or disable on a per project
//basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
//Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
//enablePlugins(SbtEbean). Note, uncommenting this line will automatically bring in
//Play enhancer, regardless of whether the line above is commented out or not.
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "1.0.0")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0")
Alles, was Sie brauchen, zu sehen?
Bisher habe ich versucht, nur reimporting Abhängigkeiten, doppelte überprüfung, um sicherzustellen, version rechts, gehen durch die Dokumentation wieder, und bisher hat nichts geklappt. Ich gehe davon aus, dass ein bestimmter Benutzer über alle Antworten 🙂
Du musst angemeldet sein, um einen Kommentar abzugeben.
Datenbank-Verbindung Konfiguration fehlt.
Definieren Sie es in
conf\application.conf
:Meine config:
Mein code: