0

我刚刚将我的操作系统从 Ubuntu 10.04 重新安装到 12.04,并且我在 ubuntu 10.04 上使用 play 2.0.1,在 10.04 上一切正常,但是现在使用相同的 play 2.0.1 事情搞砸了,现在每次我运行命令play "run 80"服务器启动,但是当我点击我的应用程序的索引页面时,它给了我以下异常:

[error] application - 

! @6bh1b1h5g - Internal server error, for request [GET /] ->

play.api.Configuration$$anon$1: Configuration error [Cannot connect to database [mytestdb]]
    at play.api.Configuration$.play$api$Configuration$$configError(Configuration.scala:71) ~[play_2.9.1.jar:2.0.1]
    at play.api.Configuration.reportError(Configuration.scala:258) ~[play_2.9.1.jar:2.0.1]
    at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:240) ~[play_2.9.1.jar:2.0.1]
    at play.api.db.BoneCPPlugin$$anonfun$onStart$1.apply(DB.scala:231) ~[play_2.9.1.jar:2.0.1]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.2]
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194) ~[scala-library.jar:0.11.2]

在来到这个论坛之前,我仔细检查了:

  1. mysql 正在运行。
  2. 用户具有足够的权限(通过登录该用户并在 bash 终端内的该数据库上运行一些选择命令)。
  3. 我的项目编译成功。

配置文件有一些小的改动:

# This is the main configuration file for the application.
# ~~~~~

# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="*********************************"

# The application languages
# ~~~~~
application.langs="en"

# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# global=Global

# Database configuration
# ~~~~~ 
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#

db.mytestdb.url="mysql://user1:user1@127.0.0.1:3306/mytestdb"
db.mytestdb.driver=com.mysql.jdbc.Driver
db.mytestdb.user="user1"
db.mytestdb.pass="user1"
db.mytestdb.jndiName=mytestdbDS

jpa.default=TESTmytestdb
jpa.TESTmytestdb=TESTmytestdb

# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .

# Root logger:
logger.root=ERROR

# Logger used by the framework:
logger.play=INFO

# Logger provided to your application:
logger.application=DEBUG
4

3 回答 3

0

我认为这是关于您的 URL 检查其他答案并修复它:

https://stackoverflow.com/a/10007515/1066240

于 2012-09-02T12:24:45.853 回答
0

您是否尝试过像这样从 url 中删除用户:密码?

db.mytestdb.url="jdbc:mysql://localhost:3306/mytestdb"
db.mytestdb.driver=com.mysql.jdbc.Driver
db.mytestdb.user="user1"
db.mytestdb.pass="user1"
于 2012-09-12T13:12:04.400 回答
0

这是没有启动的memcached问题。现在我通过启动 memcached 让它工作了。

于 2012-10-02T09:00:08.530 回答