我刚刚将我的操作系统从 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]
在来到这个论坛之前,我仔细检查了:
- mysql 正在运行。
- 用户具有足够的权限(通过登录该用户并在 bash 终端内的该数据库上运行一些选择命令)。
- 我的项目编译成功。
配置文件有一些小的改动:
# 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