Wednesday, 16 June 2010

AppEngine first steps

I have just got a prototype of a small application for a client. This takes input data, processes it and displays the result.

I needed to get it up on a web site so the client could have a look at it. Seemed like the perfect excuse to have a go at Google AppEngine.

I downloaded the SDK and Eclipse Plugin. As I had already created the web application, I could not use the support in the plugin to run the application out of the box. The fix was quite simple though, I created a AppEngine project, then copied the launch configuration. Playing with the path to the war folder and the classpath, soon got the app running in the local AppEngine server.

The first issue I ran into was that Freemarker does not work on AppEngine. A quick google search, turned up a patched Freemarker jar for AppEngine - perfect. I put this into our ivy repository, changed the dependency in the project, rebuild and the application runs perfectly.

Now to get it live. I created an application in AppEngine and used the SDK to upload the application - this is really easy - ./ update /path/to/war/folder.

After a few minutes all seems ready, however when I go to the application, an error page is displayed. What is wrong? After I found out how to get to the admin console (the URL is different if you have a Google Apps for Domains Account), I found a log viewer. This showed some more Freemarker errors.

java.lang.IllegalAccessError: Class$1 can not access a member of class freemarker.ext.jsp.FreeMarkerPageContext21 with modifiers "static"

Turned out to be a silly mistake. Another ivy dependency was bringing in the old Freemarker jar file. I did get to find out about how AppEngine keeps old and versions of your application as well and lets you access them via alternate URLs of the form http://[verion].latest.[your-app] Very handy for final testing before "going live".

No comments: