My last article about simple Grails application showed, that for quick development Grails are one of top choices. Inspired by some folks writing all around the web, that Grails plus GAE are even faster web-development solutions, I’ve decided to give it a try. And that’s where troubles came up.
Google App-Engine is quite a new platform for developing projects. Originally, it was Python only, now Java is also available. Since Grails uses standard servlet container, it can be easily deployed on JVM based architecture provided by GAE. Sounds simple and easy, doesn’t it?
Before we can start using app-engine plugin for Grails, let’s make sure that we have Grails version 1.1.1. Unfortunately, the latest release of Grails (1.2-M2) is not compatible with GAE. That is quite a surprise and the reason of my haedache. I tried for an hour to deploy some apps on GAE, but with no result. Twitter Client from my last article was a perfect shot for testing Grails on Google platform. Of course, not only for the sake of tests, but also for showing results of Grails development. Finally, I gave up, because GAE support for some functionalities is still too poor or buggy.
App-Engine install
First – download latest Google App-Engine SDK and unpack it somewhere on your disk. When done – set up enviromental path for APPENGINE_HOME, like it’s done here (for Windows):
And that’s it!
Install Grails plugin
It’s time to create your Grails application. Make sure, that app name is very unique because it must be the same on GAE. Create it either by command line or with your IDE. With the first option type in command line:
grails create-app WhateverName , then enter newly created projects’ folder and type:
grails install-plugin app-engine .
When it comes to IDE – and I’m using NetBeans – we simply create New Groovy project, right-click on it, select ‘Grails Plugins’ and choose app-engine from the list.
Prepare application
Let’s try this simplified way of creating application only for a quick testing GAE and Grails:
grails create-domain-class com.strange.Namefoo
grails generate-all com.strange.Namefoo
With these two lines above we create domain class in our WhateverName application. App-Engine requires packaged domain classes for some reason. The second command generates for us whole the rest – controllers and views, what means we have an application ready to go. Ah, sorry – for GAE we still need a little bit more:
grails set-version 1
App-Engine requires quite strict version numeration, so it won’t accept numbers like 0.1.
Deploy application
First of all, we need account on Google App-Engine If you have Google account it is enough to login. Than we have to create application with our WhateverName (should be exact match).
Back to our command line; let’s prepare war for our app:
grails app-engine package
Now we can deploy it on GAE platform:
C:\appengine_sdk\bin\appcfg.cmd update C:\WhateverName\target\war
This command works for Windows with folder paths specified as above. And if no errors occure we will be able to see progress of deploying. We will be asked for our Google email and password too. After finished deployment our application can be found under the adress http://WhateverName.appspot.com. All of that sounds easy, but believe me, I’ve had hard time trying to figure out what causes errors, blank pages, etc.
Troubles…
- no java threads
- no writing to filesystem
- no JDBC support
- you can create only 10 apps, but they cannot be deleted
- the latest Grails not supported
This list covers only a few minor issues, check jira.codehaus.org/browse/GRAILS for many other problems. There is also site for Grails plugins: jira.codehaus.org/browse/GRAILSPLUGINS.
Summary
It’s a real pain to develop more complicated Grails applications on Google App-Engine. Still GAE is a decent solution for many projects, since it’s free (up to some limits). Still buggy and annoying, but seriously: App-Engine has been supporting Java for like three months and Grails app-engine plug-in is even younger, so I’m pretty sure some problems will be solved soon. I’m quite curious about other users experiences with Grails and App-Engine.
So please share your experiences and troubles with us. And stay tuned.
when are you going to show a facebook using grails?
Hello roy,
I'm not quite sure if I understood your question, did you mean using facebook API along with grails?
Regards
Wojtek Gasperowicz
Well , the view of the passage is totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs. I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum! http://less-accurate.com/
Here elaborates the matter not only extensively but also detailly .I support the
write's unique point.It is useful and benefit to your daily life.You can go those thefer.net Like-Acer tiny let-lands iamateacherithink
sits to know more relate things.They are strongly recommended by friends.Personally
I feel quite well.