4

単純なアイテムをH2データベースに保存しようとすると、このエラーが発生します。

"javax.persistence.PersistenceException: The default EbeanServer has not been defined ? This is normally set via the ebean.datasource.default property. Otherwise it should be registered programatically via registerServer()"

私のplayapplication.confファイル

 # Database configuration
    # ~~~~~
    # You can declare as many datasources as you want.
    # By convention, the default datasource is named `efault
    db.default.driver=org.h2.Driver
    db.default.url="jdbc:h2:mem:play"
    db.default.jndiName=DefaultDS
    db.default.user=sa
    db.default.password=""

    # JPA configuration
    # ~~~~~
    # You can declare as many Ebean servers as you want.
    # By convention, the default server is named `default`
   jpa.default=defaultPersistenceUnit  
   ebean.datasource.default=DefaultDS
   ebean.default="models.*"
4

2 に答える 2

3

JNDIデータソースを使用するには、以下を設定する必要があります。

ebean.datasource.factory=jndi

そして、datasource.defaultをJNDIデータソース名として使用します。さらに、デフォルトでjava:comp / env /jdbc/になっているebean.datasource.jndi.prefixをオーバーライドできます。

于 2012-07-02T17:01:32.757 に答える
0

これは、適切な.confファイルがない場合によく発生します。たとえば、次のコマンドを使用してPlayFrameworkを実行します。

~/play-2.1.2/play -Dconfig.file=conf/local.conf

そして、私はlocal.confファイルを持っていません。

于 2013-07-29T08:14:42.913 に答える