Blogs

SpringSource Blog

Grails 1.1.1 released with Google AppEngine support

grocher

Today we are pleased to announce the availability of Grails 1.1.1 which whilst providing many incremental improvements over Grails 1.1 also introduces official support for Google AppEngine.

Groovy itself has been running on AppEngine since its launch, but we had to make a few tweaks here and there in Grails to make Grails applications run on AppEngine.

Included in this is the introduction of an AppEngine plugin which replaces Hibernate with JDO (and soon JPA) for persistence in order to take advantage of Google's DataStore API. The AppEngine plugin also integrates the AppEngine development environment with Grails so that you can run your Grails application locally inside the AppEngine container whilst still benefiting from hot reloading support.

Getting Started

As with many things in Grails the ease of use is something best demonstrated visually, hence we have prepared a screencast demonstrating creating a Grails application and deploying to Google AppEngine using the AppEngine plugin. Simply click on the image below to start the screencast:

Grails AppEngine Screencast

For even more information there are detailed step-by-step instructions on how to create and deploy a Grails application to Google AppEngine on the AppEngine plugin page.

The Future

The Grails and AppEngine combination is already the most productive combination you can use to deploy Java applications to AppEngine, but we are not finished yet. We are hard at work on building GORM-like abstractions over JPA and JDO in order to bring productivity enhancements to the AppEngine DataStore API and users of JPA/JDO in general.

Luckily since Groovy produces valid Java bytecode we are able to take advantage of all of the AppEngine features and tools such as the DataNucleus Enhancer. The ultimate goal is to make Grails the primary environment for building applications targeting the AppEngine Java SDK and a real viable alternative from a productivity standpoint to the Python SDK.  What we have introduced today is a great step in that direction.

Resources

Similar Posts

Share this Post
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • DZone
  • LinkedIn
  • Slashdot
  • Technorati
  • Twitter
 

16 responses


  1. Great news!

    We are looking forward to see all Grails features on GAE.


  2. Taking it for a test drive now.
    thanks a lot!


  3. This is really great news! Thanks, Grails team!

    Does the JDO support mean that I can configure Grails to use JDO outside of the AppEngine as well, or should I wait for the JDO/JPA abstraction layer?

    -matthew


  4. You could do this before, Grails is afterall just Spring so you can configure whatever you want. All you have to do first is uninstall the Hibernate plugin

    grails uninstall-plugin hibernate

    And then you can configure JDO inside your application. The AppEngine plugin configures JDO for you, we could write a more general purpose plugin for configuring JDO too.


  5. A more general purpose plug-in for configuring JDO would be great to have.


  6. I've tried to follow along with the screen case but have a number of issues.

    First after I create the domain class and perform generate-all I get:

    groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed, Si
    mpleTemplateScript1.groovy: 2: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor
    @ line 2, column 16.
    1 error

    at _GrailsGenerate_groovy.generateForDomainClass(_GrailsGenerate_groovy:85)
    at _GrailsGenerate_groovy$_run_closure1.doCall(_GrailsGenerate_groovy:50)
    at GenerateAll$_run_closure1.doCall(GenerateAll.groovy:42)
    at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
    at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:344)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:334)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.processTargets(Gant.groovy:495)
    at gant.Gant.processTargets(Gant.groovy:480)
    Error running generate-all: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed, SimpleTemplateScript1.groovy: 2: unable to resolve class org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor
    @ line 2, column 16.
    1 error

    Trying to deploy an empty skeleton app to app engine (with GAE SDK 1.2.1) – so no domain classes et cetera gives me:

    C:\dev\grails\grails-1.1.1\projects\jan-vissers>%APPENGINE_HOME%\bin\appcfg update .\target\war
    Email: **********
    Reading application configuration data…
    Bad configuration: XML error validating .\target\war\WEB-INF\datastore-indexes.xml against C:\dev\gae\appengine-java-sdk-1.2.1\docs\datastore-indexes.xsd
    Caused by: cvc-elt.1: Cannot find the declaration of element 'datastore-indexes'.

    I must be doing something. But what?


  7. I hit the same issue with the generate-all command. I simply installed the hibernate plugin again, ran the generate-all and then uninstalled the hibernate plugin.

    I'm using the 1.2.1 version of the AppEngine SDK and got the following error trying to update the app:

    $ /Developer/Google/appengine-java-sdk-1.2.1/bin/appcfg.sh update target/war/
    Reading application configuration data…
    Bad configuration: XML error validating target/war/WEB-INF/datastore-indexes.xml against /Developer/Google/appengine-java-sdk-1.2.1/docs/datastore-indexes.xsd
    Caused by: cvc-elt.1: Cannot find the declaration of element 'datastore-indexes'.
    Please see the logs [/tmp/appcfg32522.log] for further information.

    I got around that by removing the target/war/WEB-INF/datastore-indexes.xml file before updating.

    So here is my command sequence:

    grails create-app springdeveloper-music-store
    cd springdeveloper-music-store/
    grails uninstall-plugin hibernate
    grails install-plugin app-engine
    export APPENGINE_HOME=/Developer/Google/appengine-java-sdk-1.2.1
    grails create-domain-class com.springdeveloper.music.Album
    grails install-plugin hibernate
    grails generate-all com.springdeveloper.music.Album
    grails uninstall-plugin hibernate
    grails app-engine package
    rm target/war/WEB-INF/datastore-indexes.xml
    /Developer/Google/appengine-java-sdk-1.2.1/bin/appcfg.sh update target/war/

    -Thomas


  8. Mindboggling cool! Should definitely put Grails on everyone's radar screen.


  9. Nice work! I managed to deploy with just couple changes to the steps on my windows box.

    1. grails app-engine (CTRL C, would not kill the process used by com.google.appengine.tools.development.DevAppServerMain, so this would interfere in subsequent startups if unnoticed. I had to kill manually.)

    2. GroovyRuntimeException seems to be a bug and the resolution discussed here (
    http://www.nabble.com/generate-views-error-for-plugin-dev-in-grails-1.1-td22856663.html) works. The steps I had to follow was:

    grails install-plugin hibernate
    grails generate-all com.bookstore.Book
    grails uninstall-plugin hibernate
    grails app-engine

    My app is live @ http://book-store.appspot.com/book/list

    Thanks Grails team for this neat integration with App-engine.

    -Arul


  10. Thanks guys (Thomas/Arulazi) – got it working now.


  11. Very nice work!

    The thing is, I finally started to "get" Python and I created a mashup with it (http://my-favorite-places.appspot.com/). The day I gave a demo about it at work, the AppEngine Java SDK was released, so learning Python wasn't really necessary (but a nice addition to my knowledge anyway).

    Today I converted the app to Grails, which you can see here:
    http://favorite-places.appspot.com/

    I also had the problem with target/war/WEB-INF/datastore-indexes.xml which needs to be removed before uploading to AppEngine.


  12. Thomas – heh.. thanks for the instructions for the workaround.
    Now, to the real issue..
    Could we somehow, slowdown releases? I mean, it seems that right now there is a mad rush to be able to twitter "we did it!" when in fact.. as Thomas's post indicates.. that actual solution is very very far from done.

    Grails, to me, is this massive performance enhancing tool.. and right now, it seems like it is 20 hours a week, late at night, moving sideways and not forward at all :)


  13. Hi Grocher,

    I am working on web app slowly at my spare time. Right now I am using grails 1.04 mySql running on Ubuntu 8.10. This project is still at its early stage and expected to launch in about one year. Now since grails 1.1.1 starts to support google app engine, I am very excited about what you did and thinking about to make a move.

    Would you please give me some advices if I should make the move?

    Thanks,
    Bendanpa


  14. Hi,

    I read all the posts here and try to solve problem occurred when running the default application created by the following sequence.

    grails create-app test
    cd test
    grails uninstall-plugin hibernate
    grails install-plugin app-engine
    grails create-domain-class com.test.User
    grails install-plugin hibernate
    grails generate-all com.test.User
    grails uninstall-plugin hibernate
    grails app-engine run

    Question 1: I selected JPA when installing app-engine, but this line
    "Configuring JDO for AppEngine"
    appeared in the output after I ran "grails app-engine run".
    Is this a bug?

    Question 2: Now the last line of the output says open the browser and goto
    "http://localhost:8080/"

    When I do that, the browser page shows "Grails Runtime Exception"

    and the windows console shows a bunch of exceptions, here is some of it.
    WARNING: EXCEPTION
    org.springframework.web.util.NestedServletException: Request process
    ing failed; nested exception is org.codehaus.groovy.grails.web.mapping.exception
    s.UrlMappingException: Error mapping onto view [/error]: Error evaluating expres
    sion [request.'javax.servlet.error.message'.encodeAsHTML()] on line [31]: java.l
    ang.NoClassDefFoundError: Could not initialize class org.springframework.web.uti
    l.HtmlUtils
    at org.springframework.web.servlet.FrameworkServlet.processReque
    st(FrameworkServlet.java:583)
    at org.springframework.web.servlet.FrameworkServlet.doGet(Framew
    orkServlet.java:501)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.
    java:487)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandle
    r.java:362)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHan
    dler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandle
    r.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandle
    r.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.j
    ava:405)
    at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.h
    andle(DevAppEngineWebAppContext.java:54)

    I am using Grails 1.1.1 and app-engine-0.8.3.
    I just want to make the default application with views running on my local windows. I had a success without view created.

    Can someone show a simple tutorial to do that?

    Thanks,
    gapes


  15. It simple does not work properly with gae.
    Only one time in my experience with grails gae it does not thrown the 500 error.. one time it were working and displayed hello world. I more see no reason to play with grails..


  16. tom ur solution work fine. but let me check it in the real environment later. thanks

9 trackbacks

Leave a Reply