play! + GAE+ JPA

106 views
Skip to first unread message

yuanchangjun

unread,
Aug 27, 2009, 12:35:29 AM8/27/09
to play-framework
I am a newer, I don't know how to configure jpa in google app engine?

Hint:
Exception in thread "main" play.exceptions.JPAException: Cannot start
a JPA manager without a properly configured database
at play.db.jpa.JPAPlugin.onApplicationStart(JPAPlugin.java:33)
at play.Play.start(Play.java:338)
at play.Play.init(Play.java:199)
at play.server.Server.main(Server.java:58)
Caused by: java.lang.NullPointerException: No datasource
... 4 more
Java Result: 1
Message has been deleted

Lynn Peng

unread,
Aug 27, 2009, 11:29:17 AM8/27/09
to play-framework
Comment all DB setting in application.conf, and add this:

module.gae=${play.path}/modules/gae


Hope it works for you.

袁长军

unread,
Aug 27, 2009, 9:28:58 PM8/27/09
to play-fr...@googlegroups.com
I comment all DB setting in application.conf, and add this: module.gae=${play.path}/modules/gae,  but it don't work for me!

This is my application.conf:

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

# Application mode
# ~~~~~
# Set to dev to enable instant reloading and other development help.
# Otherwise set to prod.
#
application.mode=dev
# application.mode=prod

# 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=1hsoz0insmvlbfh5zd6mbf3cftdtuwdq6zpo4ez020ayyga959jd0nocu4h8tt5p

# Additional modules
# ~~~~~
# A module is another play! application. Add a line for each module you want
# to add to your application. Modules path are either absolutes or relative to
# the application root.
#
#module.ecss=${play.path}/modules/ecss
module.crud=${play.path}/modules/crud
module.gae=${play.path}/modules/gae

# i18n
# ~~~~~
# Define locales used by your application.
# You can then place localized messages in conf/messages.{locale} files
#
# application.langs=fr,en,ja

# Server configuration
# ~~~~~
# If you need to change the HTTP port, uncomment this (default is set to 9000)
#
# http.port=9000

# JPDA configuration
# ~~~~~
# Define which port is used by JPDA when application is in debug mode (default is set to 8000)
#
# jpda.port=8000

# Log level
# ~~~~~
# Specify log level for your application.
# If you want a very customized log, create a log4j.properties file in the conf directory
#
# application.log=INFO

# Database configuration
# ~~~~~ 
# Enable a database engine if needed.
# There are two built in values :
#   - mem : for a transient in memory database (HSQL in memory)
#   - fs  : for a simple file written database (HSQL file stored)
#
# db=mem
#
# If you need a full jdbc configuration use the following :
#
# db.url=jdbc:mysql://localhost/test
# db.driver=com.mysql.jdbc.Driver
# db.user=root
# db.pass=
#
# Connections pool configuration :
#
# db.pool.timeout=1000
# db.pool.maxSize=30
# db.pool.minSize=10

# JPA Configuration (hibernate)
# ~~~~~
#
# Specify the custom JPA dialect to use here (default to guess) :
# jpa.dialect=org.hibernate.dialect.MySQLDialect
#
# Specify the ddl generation pattern to use (default to update) :
# jpa.ddl=update
#
# Debug SQL statements :
# jpa.debugSQL=true

############################### Google App Engine ##############################
# jpa.dialect=play.modules.gae.DataNucleusDialect


# Memcached configuration
# ~~~~~ 
# Enable memcached if needed. Otherwise a local cache is used.
# memcached=enabled
#
# Specify memcached host (default to 127.0.0.1:11211)
# memcached.host=127.0.0.1:11211
#
# Or you can specify multiple host to build a distributed cache
# memcached.1.host=127.0.0.1:11211
# memcached.2.host=127.0.0.1:11212

# Mail configuration
# ~~~~~ 
# Default is to use a mock Mailer
mail.smtp=mock

# Or, specify mail host configuration
# mail.smtp.host=127.0.0.1
# mail.smtp.user=admin
# mail.smtp.pass=
# mail.smtp.channel=ssl

# Open file from errors pages
# ~~~~~
# If your text editor supports to open files using URL, Play! will link
# error pages to files dynamically
#
# play.editor=txmt://open?url=file://%s&line=%s


# Testing. Set up a custom configuration for test mode
# ~~~~~
%test.application.mode=dev
%test.db=mem
%test.jpa.ddl=create-drop
%test.mail.smtp=mock

This is my starting Info:

nb-run-application:
D:\play-1.0-stable6\id doesn't exist
Listening for transport dt_socket at address: 8000
09:21:34,328 INFO  ~ 
09:21:34,343 INFO  ~ Starting E:\play_demo
09:21:34,359 INFO  ~ Module crud is available (D:\play-1.0-stable6\modules\crud)
09:21:34,359 INFO  ~ Module gae is available (D:\play-1.0-stable6\modules\gae)
09:21:34,531 WARN  ~ You're running Play! in DEV mode
09:21:34,531 INFO  ~ Application 'play_demo' is ready !
09:21:34,781 INFO  ~ Listening for HTTP on port 9000 ...
09:21:57,671 ERROR ~ 

@5pl0a7nln
For request GET /
Internal Server Error (500)

JPA error
A JPA error occured (Cannot start a JPA manager without a properly configured database): No datasource

play.exceptions.JPAException: Cannot start a JPA manager without a properly configured database
        at play.db.jpa.JPAPlugin.onApplicationStart(JPAPlugin.java:33)
        at play.Play.start(Play.java:338)
        at play.Play.detectChanges(Play.java:403)
        at play.Invoker$Invocation.before(Invoker.java:62)
        at play.Invoker$Invocation.doIt(Invoker.java:109)
        at play.server.HttpHandler$MinaInvocation.doIt(HttpHandler.java:387)
        at play.Invoker.invokeInThread(Invoker.java:44)
        at play.server.HttpHandler.messageReceived(HttpHandler.java:80)
        at Play!.HTTP Server(Mina)
Caused by: java.lang.NullPointerException: No datasource
        ... 9 more
09:21:58,000 ERROR ~
Reply all
Reply to author
Forward
0 new messages