オペレーティングシステムを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