- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
最近升级到 Play 2.4,我仍在学习所有的小怪癖等。我正在努力让我的索引页面正常工作,但我很难过,而且我知道这是我遗漏的一些小东西。这是错误
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):
还有我的配置信息(是的,mysql 的端口号是正确的)
应用程序.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.*"]
主 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);
}
内置.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)
插件.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")
您还有什么需要看的吗?
到目前为止,我已经尝试过重新导入依赖项,仔细检查以确保版本正确,再次查看文档,但到目前为止没有任何效果。我期待某个用户会得到所有的答案:)
最佳答案
Database connection configuration丢失了。
在conf\application.conf
中定义:
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/playdb"
db.default.username=playdbuser
db.default.password="a strong password"
关于java - 神秘玩2.4注入(inject)异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31244106/
我正在尝试更新我的 jtable(更改值并按 Enter 键),但出现错误。由于大小原因,错误未完整。我认为其余部分只是 c3p0 池连接工具生成的不相关信息。 假设 起初,我认为这可能是 c3p0
每当我有两个水平并排的元素并指定了右和/或左填充和/或边距时,元素之间通常会在我指定的上方和上方有空格。我希望有人能告诉我如何消除该空间(没有像负边距这样的笨拙东西)。 请注意:我并不是在寻找替代的多
String[] parts = msg.split(" +\n?"); String room = parts[0]; System.out.println(msg); Sy
我知道“一定有什么东西被改变了”,但我的代码似乎在一夜之间无缘无故地崩溃了。 我的服务器目录结构是这样的: / /scripts /audit /other_things 我在“scripts”文件夹
我正在尝试了解 GCM 的工作原理。为此,我复制/粘贴 http://developer.android.com/ 的代码在“实现 GCM 客户端”部分中提出。 从服务器发送消息是可行的,但是当我的客
在生成随机整数时,我发现了一些有趣的事情(至少对我而言),我无法向自己解释,所以我想我会把它贴在这里。 我的需求很简单:我要生成随机积分 (Int32) ID 并旨在最大程度地减少冲突。生成时间不是问
在这里https://stackoverflow.com/a/19915925/4673197我了解到我可以通过设置 IFS 将字符串拆分为数组。 在这里https://stackoverflow.c
我现在正在为我的 CS 测试学习,并尝试编写代码,以明文形式给出整个 IMDB 数据库,找到电影中共同点最多的 Actor 。我已经差不多完成了,只是不断遇到一个奇怪的 KeyError。这是我的代码
在 Android 平台上开发了几个月之后,我仍然有一个悬而未决的问题。很久以前,我注意到我有一个 Activity 不符合应用程序主题的其余部分。这意味着默认情况下,Activity 的字体颜色是白
本周,我注意到我的团队 Azure 门户上有一个持续的网络作业。 团队中没有人表示他们已经部署了它,或者熟悉它。我找到了这个博客: https://azure.microsoft.com/en-ca/
所以我正在制作一个小型闲置游戏,我的部分努力是格式化所有数字,以便它们之间有逗号(出于美观目的)。我成功地让我的货币 Energy 带有这些逗号,但我很难添加其他变量。我用了num.toLocaleS
我遇到了一个我以前从未见过的奇怪问题,我认为它一定是一些我在代码中没有看到的简单问题。 我有一个项目,其中定义了 2 个 Windows 服务。一个我称为 DataSyncService,另一个称为
我有这个jsfiddle一次有效。 function toggle_off(itemID){ alert(itemID+'->'+document.getElementById(itemID).g
更新:已解决,我是白痴,谢谢大家! Okay little bit weird.. I just created a layout file for list items, I can see it
问题:这段代码究竟在做什么? 另外:“w”的使用方式是否是某种现有算法?我试图弄清楚函数的意图,或者至少描述它产生的数字种类。 上下文:我正在查看 Martin O'Leary 的“Fantasy M
你能帮帮我吗?我正在将自己传递给它自己的纯虚函数。 n->dataCallback(handler, n, hangup); 其中 n 是我的类指针,dataCallback 是它自己的(纯)虚函数(
我知道这里有数百万篇关于这个异常(exception)的帖子,但我不明白这里的这个。我有一个极端简单的示例管道服务: [ServiceContract] public interface ISRARi
此代码有效,但它如何不实际调用任何列出的方法。它有效,但它的工作原理和原因似乎几乎是神奇的。我实际上从未调用过 Equals、GetHashCode 或 Compare,但代码有效。我也从不在实现两个
警告: Element 'TextStyle' from SDK library 'ui.dart' is implicitly hidden by 'text_style.dart'. 代码摘录:
我有一个似乎无法解开的谜。我有这个非常简单的单元测试,它使用了一个非常简单的自定义属性。该属性仅添加到甚至未实例化的 1 个类。我计算属性被构建的次数。由于类 MyDummyClass 上的属性,我希
我是一名优秀的程序员,十分优秀!