Deploying on Google App Engine

178 views
Skip to first unread message

Alberto Gimeno

unread,
May 26, 2009, 8:05:54 AM5/26/09
to play-framework
Hi!

I'm trying to deploy my application on Google App Engine.

I got this error: (I'm using play-1.0-stable6-r414)

# 05-26 05:00AM 29.110 play.Logger info: Play! is running in Google App Engine
# I 05-26 05:00AM 29.128 play.Logger info:
# I 05-26 05:00AM 29.128 play.Logger info: Starting
/base/data/home/apps/dmo/2.333756329075309259/WEB-INF/application
# I 05-26 05:00AM 29.137 play.Logger info: Module gae is available
(/base/data/home/apps/dmo/2.333756329075309259/WEB-INF/modules/gae)
# I 05-26 05:00AM 29.511 play.Logger info: Precompiling ...
# E 05-26 05:00AM 52.688
play.Logger error: Cannot start in PROD mode with errors
java.lang.ClassCastException:
org.codehaus.groovy.control.messages.ExceptionMessage cannot be cast
to org.codehaus.groovy.control.messages.SyntaxErrorMessage
at play.templates.Template.compile(Template.java:146)
at play.templates.TemplateLoader.scan(TemplateLoader.java:85)
at play.templates.TemplateLoader.scan(TemplateLoader.java:94)
at play.templates.TemplateLoader.scan(TemplateLoader.java:94)
at play.templates.TemplateLoader.scan(TemplateLoader.java:94)
at play.templates.TemplateLoader.getAllTemplate(TemplateLoader.java:75)
at play.Play.preCompile(Play.java:378)
at play.Play.init(Play.java:198)
at play.server.ServletWrapper.init(ServletWrapper.java:53)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
[...]

# E 05-26 05:00AM 54.877
play.Logger niceThrowable:

@5okm1i9hb
For request null
Internal Server Error (500)

Unexpected error
Unexpected error : Application is not started

play.exceptions.UnexpectedException: Application is not started
at play.Invoker$Invocation.before(Invoker.java:65)
at play.Invoker$Invocation.doIt(Invoker.java:109)
at play.server.ServletWrapper$ServletInvocation.doIt(ServletWrapper.java:331)
at play.Invoker.invokeInThread(Invoker.java:44)
at play.server.ServletWrapper.service(ServletWrapper.java:82)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)


--
Alberto Gimeno Brieba
email y gtalk: gime...@gmail.com
blog: http://gimenete.net
web favorita: http://www.debugmodeon.com
teléfono móvil: +34 625 24 64 81

Alberto Gimeno

unread,
May 26, 2009, 8:34:51 AM5/26/09
to play-framework
Following the manual step-by-step
http://www.playframework.org/manual/contents/gae
I get this error when running with the sdk with dev_appserver.sh

Caused by: java.lang.ClassNotFoundException:
com.google.appengine.api.memcache.MemcacheServiceFactory

I'm using appengine-java-sdk-1.2.1

And it also fails when I deploy it.

Alberto Gimeno

unread,
May 26, 2009, 9:06:27 AM5/26/09
to play-framework
I have commented some lines on play/templates/Template.java to avoid
the ClassCastException. And this is the root exception:


play.Logger niceThrowable:

@5okm9og9d
For request null


Cannot start in PROD mode with errors

Oops: MultipleCompilationErrorsException
An unexpected error occured caused by exception
MultipleCompilationErrorsException:<br/> startup failed, General error
during class generation: Unable to get members for class
play.modules.gae.GAE java.lang.SecurityException: Unable to get
members for class play.modules.gae.GAE at
com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_$10.run(Class_.java:357)
at com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_$10.run(Class_.java:347)
at java.security.AccessController.doPrivileged(Native Method) at
com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.getMembers(Class_.java:347)
at com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.getDeclaredMethods(Class_.java:174)
at org.codehaus.groovy.vmplugin.v4.Java4.configureClassNode(Java4.java:50)
at

Guillaume Bort

unread,
May 26, 2009, 9:39:01 AM5/26/09
to play-fr...@googlegroups.com
Hm,

Which version of the Google App Engine SDK do you use ?
Just tried with the latest (1.2.1) and the simple tutorial just work
(in local mode almost).

Guillaume Bort

unread,
May 26, 2009, 9:43:19 AM5/26/09
to play-fr...@googlegroups.com
>>> I'm using appengine-java-sdk-1.2.1

Sorry :)

Guillaume Bort

unread,
May 26, 2009, 9:45:07 AM5/26/09
to play-fr...@googlegroups.com
Do you have these errors using the local SDK or while running on the real GAE ?

On Tue, May 26, 2009 at 3:43 PM, Guillaume Bort

Alberto Gimeno

unread,
May 26, 2009, 9:56:29 AM5/26/09
to play-fr...@googlegroups.com
These are the steps I follow:

> play-1.0-stable6/play new test-gae

I edit the conf/application.conf file putting the following new line

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

(and I comment this line: #module.crud=${play.path}/modules/crud )

I edit app/controllers/Application.java. This is the index() method

public static void index() {
renderText("Hello world");
}

I run the application with play, I go to http://localhost:9000/ And
it works. It just prints "Hello world".

I edit war/WEB-INF/appengine-web.xml and put my application id and version

I generate the war

> play-1.0-stable6/play war -o ../test-gae-war

I run the application with the SDK

> appengine-java-sdk-1.2.1/bin/dev_appserver.sh ../test-gae-war/
> The server is running at http://localhost:8080/

I go to http://localhost:8080/ and this is the error

Oops: NoClassDefFoundError

An unexpected error occured caused by exception NoClassDefFoundError:
com/google/appengine/api/memcache/MemcacheServiceFactory


Then I try to update the application to google app engine:

> appengine-java-sdk-1.2.1/bin/appcfg.sh update ../test-gae-war/
> [...]
> Update completed successfully.
> Success.
> Cleaning up temporary files...

I visit my application (http://dmo.appspot.com/) and I just see an
error message. In the dashboard I can see the exception stack trace I
put in the first mail.

I have tried with different versions of play: play-1.0-stable6 and
play-1.0-stable6-r414

Thanks in advance.



On Tue, May 26, 2009 at 3:39 PM, Guillaume Bort
<guillau...@gmail.com> wrote:
>

Guillaume Bort

unread,
May 26, 2009, 10:09:38 AM5/26/09
to play-fr...@googlegroups.com
Ok these steps work for me with the 414, but I try on windows right now.
Do you use MacOS or Linux ?

There is something bad thus. If you look at the WEB-INF/lib directory
of your generated WAR, do you see some provided-* jars ?
If so delete them, and tell me if it fix the problem.

Tx

Alberto Gimeno

unread,
May 26, 2009, 10:13:09 AM5/26/09
to play-fr...@googlegroups.com
I use MacOS X. This is the content of my test-gae-war/WEB-INF/lib directory

SnakeYAML-1.2.jar
ZDB.jar
activation.jar
antlr-2.7.6.jar
asm-3.1.jar
asyncweb-common-0.9.0-SNAPSHOT.jar
backport-util-concurrent-3.0.jar
bcprov-jdk15-142.jar
c3p0-0.9.1.jar
cglib-nodep-2.2.jar
commons-beanutils.jar
commons-codec.jar
commons-collections-3.1.jar
commons-fileupload-1.2.jar
commons-httpclient.jar
commons-io.jar
commons-lang.jar
commons-logging-1.1.1.jar
compiler-jdt.jar
datanucleus-appengine-1.0.0.final.jar
datanucleus-core-1.1.0.jar
datanucleus-enhancer-1.1.0.jar
datanucleus-jpa-1.1.0.jar
dom4j-1.6.1.jar
ehcache-1.5.0.jar
ejb3-persistence.jar
ezmorph-1.0.3.jar
flexjson_modified.jar
groovy-all-1.6.1.jar
hibernate-annotations.jar
hibernate-commons-annotations.jar
hibernate-entitymanager.jar
hibernate3.jar
hsqldb.jar
htmlparser.jar
java-openid-sxip-0.9.4.339-light.jar
javassist.jar
jaxen-1.1.jar
jdo2-api-2.3-SNAPSHOT.jar
jregex1.2_01.jar
json-lib-2.2.2-jdk15.jar
jsr107cache-1.0.jar
jta.jar
junit-4.4.jar
log4j-1.2.16.jar
lucene-analyzers-2.3.1.jar
lucene-core-2.3.1.jar
mail.jar
memcached-2.1.jar
mina-core-2.0.0-M2-SNAPSHOT.jar
oval-1.31.jar
play-gae.jar
play.jar
quartz-1.6.1-RC1.jar
slf4j-api-1.5.0.jar
slf4j-log4j12-1.5.0.jar
spring-beans.jar
spring-context.jar
spring-core.jar
spy-2.4.jar


On Tue, May 26, 2009 at 4:09 PM, Guillaume Bort

Guillaume Bort

unread,
May 26, 2009, 10:17:53 AM5/26/09
to play-fr...@googlegroups.com
Well,

In fact this is because a bug with windows export the
appengine-api-1.0-sdk-1.2.0.jar to the WAR that it works for me.
It seems that the new version of the API does no more contain the
com/google/appengine/api/memcache/MemcacheServiceFactory class.

I can reproduct the bug now. It will update the API version and tell you soon.

Thanks.

Guillaume Bort

unread,
May 26, 2009, 10:28:03 AM5/26/09
to play-fr...@googlegroups.com
Ok, try the stable6-415. It should work.

On Tue, May 26, 2009 at 4:17 PM, Guillaume Bort

Alberto Gimeno

unread,
May 26, 2009, 10:29:46 AM5/26/09
to play-fr...@googlegroups.com
Many thanks. I'm going to try it! :)

On Tue, May 26, 2009 at 4:28 PM, Guillaume Bort

Alberto Gimeno

unread,
May 26, 2009, 10:51:11 AM5/26/09
to play-fr...@googlegroups.com
Now it works on my local machine with the SDK. But when I upload the
application I get this error:

Nested in javax.servlet.ServletException: init:
java.lang.NoClassDefFoundError: java.net.InetAddress is a restricted
class. Please see the Google App Engine developer's guide for more
details.
at com.google.apphosting.runtime.security.shared.stub.java.net.InetAddress.<clinit>(InetAddress.java)
at net.sf.ehcache.Cache.<clinit>(Cache.java:126)
at net.sf.ehcache.config.ConfigurationHelper.createCache(ConfigurationHelper.java:418)
at net.sf.ehcache.config.ConfigurationHelper.createDefaultCache(ConfigurationHelper.java:334)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:306)
at net.sf.ehcache.CacheManager.init(CacheManager.java:226)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:213)
at net.sf.ehcache.CacheManager.create(CacheManager.java:394)
at play.cache.EhCacheImpl.<init>(EhCacheImpl.java:17)
at play.cache.EhCacheImpl.getInstance(EhCacheImpl.java:24)
at play.cache.Cache.<clinit>(Cache.java:17)
at play.Play.start(Play.java:319)
at play.Play.init(Play.java:199)
at play.server.ServletWrapper.init(ServletWrapper.java:53)

It seams that play is trying to initializate the play.cache.EhCacheImp
implementation and it doesn't work because ehcache uses
java.net.InetAddress wich is not allowed on app engine.

Thanks for your attention!

Guillaume Bort

unread,
May 26, 2009, 11:08:24 AM5/26/09
to play-fr...@googlegroups.com
Well,

I'm wonder why EHCache try to start a socket ...
Should be fixed in the 417. But I can't try on the real GAE right now.
Can you try it and tell me ?

Alberto Gimeno

unread,
May 26, 2009, 11:09:09 AM5/26/09
to play-fr...@googlegroups.com
Well, I have changed two things on play/cache/Cache.java

public static CacheImpl cacheImpl = null; // EhCacheImpl.getInstance();

And

/**
* Init the cache system.
*/
public static void init() {
/*
if (Play.configuration.getProperty("memcached",
"disabled").equals("enabled")) {
try {
cacheImpl = MemcachedImpl.getInstance();
Logger.info("Connected to memcached");
} catch (Exception e) {
Logger.error(e, "Error while connecting to memcached");
Logger.warn("Fallback to local cache");
cacheImpl = EhCacheImpl.getInstance();
}
} else {
cacheImpl = EhCacheImpl.getInstance();
}
*/
}

And now it works on the google app engine servers.

Alberto Gimeno

unread,
May 26, 2009, 11:41:57 AM5/26/09
to play-fr...@googlegroups.com
Hi!

Now it works! Thank you very much :)
Reply all
Reply to author
Forward
0 new messages