Archive for the ‘Software Development’ Category
Google App Engine for Java: CRUD Operations with JDO and Spring MVC
In a prior post, I provided and introduction to GAE for Java including getting your local development environment setup and uploading your application to Google’s servers.
For this post, I will outline how to do simple CRUD operations using GAE for Java and the latest version of Spring MVC (which is 3.0.0.M3). Combining GAE for Java and the Spring MVC framework makes for a powerful way of making your application both flexible and scalable.
Datastore Options with Google App Engine for Java
The basis for just about any web application generally includes a data store for storing information. Instead of a relational database like MySQL or Oracle, Google uses something called BigTable. For an explanation about how BigTable differs from a traditional relational database, you should check out “The Softer Side of Schemas” video from the Google I/O 2009 conference. With respect to GAE for java, you have essentially three different ways to interact with BigTable:
- JPA – Java Peristence API
- JDO – Java Data Objects
- Low level API – provided by Google for doing stuff that you can’t otherwise do with JPA or JDO. Note that both JPA and JDO use this low-level API under the covers.
JRuby on Google App Engine
I’ve been reading up on running JRuby on GAE (Google App Engine) for Java. Here are some helpful resources for future reference and for others seeking information about this exciting mix.
- appengine-jruby – This project aims to make using JRuby as easy as any of the native App Engine languages.
- JRuby on Rails on Google App Engine – blog post by Ola Bini (a JRuby contributor). “…the steps you need to take to get a JRuby on Rails application working on GAE/J, and also what kind of characteristics you should expect from your application.”
- JRuby and Ioke on Google App Engine for Java – Google I/O 2009 session video presented by Ola Bini. Not a lot of information on Rails but still has some useful and interesting info.
- ActiveSupport-JCache – a jRuby gem that lets you use Rails.cache in a jRuby on Rails on Google App Engine application. The library uses the Java Memcache API to store/restore values.
- JRuby – official JRuby site.
- Introducing JRuby-Rack - somewhat dated blog post from Nick Sieger, another JRuby contributor.
- Warbler – is a gem to make a .war file out of a Rails, Merb, or Rack-based application.
- ActionMailer-JavaMail is a jRuby gem that lets you send emails from your jRuby on Rails on Google App Engine application, but also works in standard SMTP and SMTPS scenarios. The greater intent of this gem also includes utilizing JavaMail extensions that don’t have equivalents in Ruby.
- Google Wave Robot Container in Sinatra – “Since I got a Google Wave account at Google IO, I felt like I should try to do something Ruby-ish in it. I got talking to Charles Nutter, and he suggested a Sinatra template for Wave Robots. So here it is.”
- Clone TinyURL with 40 lines of Ruby code on Google AppEngine for Java
- Bumble – A small data wrapper for Google DataStore – intended for use with Google App Engine
JSTL Expressions Not Working in Google App Engine Solution
If your JSTL expressions aren’t working with GAE for Java, try this quick fix. In your page directive, add isELIgnored=”false”. For example:
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
Google App Engine For Java: An Introduction
A couple of days ago, Google announced that Java was now available to run on Google App Engine (GAE for short). Currently, they are only letting the first 10,000 developers who sign up for an account actually deploy a Java app:
April 2009: During this “early look” of Google App Engine for Java, the ability to upload Java applications to App Engine is reserved for a limited number of developer accounts. All users will be able to upload Java apps when we do a full release of Google App Engine for Java in the near future.
Fortunately, I was able to get an account and give it a test drive. Here’s how to deploy a minimal web application without using the available Eclipse plugin:
- Install a Java SDK if you don’t already have it installed. You will need Java version 5 or above.
- Download and install the Google App Engine Java SDK. I extracted the zip to my home directory and updated my system path to include ~/appengine-java-sdk-1.2.0/bin. Once this is done I can run the appcfg.sh script.
- Now that the GAE Java tools are installed, it’s time to create a very simple Java web app. I decided to create an app with just a single JSP.
- Below is the entire directory layout with the usual WEB-INF/web.xml and the single index.jsp in the web root. You will also see two files specific to GAE for Java: appengine-web.xml and appengine-api-1.0-sdk-1.2.0.jar. These are essential in order to deploy your web app to GAE for Java./

- Below is an example of why my appengine-web.xml file looks like. There are several configuration elements which are documented here. Note that the application value here is angrygerbils which will be located at http://angrygerbils.appspot.com after I upload the app.

- For this app, my web.xml file is actually empty except for the web-app element:

- Now it’s time to upload the app to GAE for Java using appcfg.sh. I created an exploded directory call angrygerbilsWeb and uploaded it with the following command:
appcfg.sh update angrygerbilsWeb - You should see something like the following:

- Once complete, you can view the app in a browser.
- That’s it! Note that are several limitations for running Java on GAE including not being able to spawn new threads, JRE Class White List, and certain frameworks such as Struts are simply not supported. You can read more about the limitations as well as the features.
Amazon Announces Elastic MapReduce
Amazon has announced Elastic MapReduce, the latest product under it’s web services umbrella starting at $0.10 per hour. This latest offering leverages two of it’s existing products EC2 (cloud computing) and S3 (simple storage service):
Amazon Elastic MapReduce is a web service that enables businesses, researchers, data analysts, and developers to easily and cost-effectively process vast amounts of data. It utilizes a hosted Hadoop framework running on the web-scale infrastructure of Amazon Elastic Compute Cloud (AmazonEC2) and Amazon Simple Storage Service (Amazon S3).