This is a guest post by Robert Miller. If you want to guest post on this blog, check out our guest author guidelines.

Google App Engine Google App Engine For Java   Microblogging Case Study
On April 7th, Google announced an early look at Google App Engine for Java and I received access to it shortly thereafter. I was able to complete their example application and deploy it to Google servers with very little struggle. I found the Google App Engine for Java to be very entrepreneurial because it offers a simple development and deployment process along with really cheap, scalable hosting. The following are notes and a case study of my experience in developing a new microblogging service using Google App Engine for Java.

Ease of Development with the Eclipse Plugin
Google App Engine for Java includes an Eclipse plugin that makes it easy to develop and deploy a Java web application onto Google’s servers. The Eclipse plugin creates a web application project that includes all of the necessary JAR and configuration files. Further, the Eclipse plugin provides the ability to test your application on your local machine because it can start a local database and web server that emulates Google App Engine’s production environment. What’s more, the Eclipse plugin provides one-click deployment to Google App Engine’s servers. There is an online administrative tool that works in concert with the plugin to provide version management for database changes.

Really Cheap, Scalable Hosting
Last fall, I stated that one of Java’s biggest long-term problems was that there was not any really cheap, scalable hosting solutions and that Google App Engine should add Java to their list of support languages. I believe that Google App Engine can spark a resurgence in entrepreneurs choosing Java over Ruby now that Google has added Java support. Google App Engine for Java is free to use until an application exceeds the following daily usage: 46 hours of CPU time per day (i.e., processing time not idle time), 10 gigabytes of data transferred in and out, 1 gigabyte of stored data (i.e., data accumulates over time), and 2,000 e-mails. It should be noted that the free daily quotas are scheduled to be reduced: CPU time down to 6.5 hours and the data transferred down to 1 gigabyte.

Hosting environment – Google App Engine for Java meets or exceeds all of my expectations for a Java web application hosting environment because it decreases time to market, requires little or no start up costs, and supports long-term scalability and growth. Time to market benefits are derived from actions that do not need to be taken: deployment script configuration, database clustering, and web server clustering. Further, time to market is supported by built-in unit testing and easy to follow code conventions. The start up costs for licensing and hosting are zero so the only cost is time spent programming. What’s more, long-term scalability and growth can be achieved headache-free (in theory) because App Engine for Java takes responsibility for providing additional resources (i.e., servers and database storage) as they are needed.

Support for Java

Shaking off the rust – Developing and launching a new service using Google App Engine for Java meant shaking off my Java programming rust because I had not programmed Java in almost three years. The transition back into Java was helped by my attendance of JavaOne in 2006 because a lot of what I learned then is now being used in Google App Engine for Java (e.g., JDO, annotations). In addition, I have recently done some programming in Ruby on Rails so my programming acumen has not diminished entirely. In shaking off the rust, I found the Google App Engine documentation sufficient for basic tasks and that the Google App Engine Developer group was required for complex tasks.

Web application support – Google App Engine for Java supports standard Java web application development and deployment including Servlets, Filters, JSPs, and JSTL. I was unable to get JSTL working but I am assuming that it was a personal problem. Some people have pointed out that Google App Engine for Java does not support the full Java specification and the frameworks built on top of it including JDBC, JSF, Struts 2, RMI, and JAX-RPC. This can be a serious problem for porting existing applications over to App Engine for Java but should not be a big deal for new applications that can suffice with basic Servlet and JSP programming. Further, the compatibility issues are well documented so it should be easy to architect an application that can successfully run on App Engine for Java. For me, it is worth trading the full set of Java features for an easy to manage, scalable hosting environment.

Other Notes -

  • Google App Engine allows each developer account to create up to 10 applications. If you plan to use Google Accounts to authenticate users then choose your application name carefully because I could not edit my application name (for display on the user login page) after I created my app.
  • By default, an application is deployed with a domain of A free Google Apps account is required to associate your custom domain to your application.
  • Google App Engine for Java administration site includes the ability to run queries, delete data, manages versions of your application, and view usage/billing statistics.
  • You can give other developers access to your Google App Engine for Java administration site.

Case Study – New Microblogging Service
I created a new microblogging service that was programmed for and deployed on Google App Engine for Java.’s functionality is part microblog (e.g., Twitter) and part discussion forum. The simplistic look and feel is modeled after Craigslist and designed to be usable from all mobile devices. Unfortunately, Google Accounts for authentication does not work on all mobile devices. The service facilitates real-time niche discussions including:

  • An outdoor forum for outdoor enthusiasts to discuss hiking, biking, hunting, fishing, etc.
  • A pro sports forum for fans to debate their city’s NBA, MLB, NFL, and NHL teams
  • A college sports forum for fans to debate college football and basketball

The App Engine features utilized include Google Accounts for authentication, App Engine’s email service, and the default JDO implementation. Java features and frameworks put to use include Servlets/JSPs, Servlet Filters, JUnit 3, log4j, and Apache’s commons-lang. Fitnesse was used to automate HTML tests for web pages and XML tests for RSS feeds. FeedBurner was employed for generating a daily digest email of forum updates.

JDO Struggles – The only significant hangups I experienced centered around Google App Engine’s implementation of JDO and, specifically, my adjustment to Google’s non-relational database. Developing with Google App Engine for Java was the first time I had used JDO and my limited experience probably accounts for most of my struggles. However, many of the App Engine bugs and group discussions are with regard to JDO issues so I am not the only one struggling with it. Inserting, updating, and querying data was effortless once I got my JDO issues straightened out. The following are tasks that I found challenging and that took much longer than originally anticipated:

  • Defining one-to-many relationships
  • Writing queries that do not use the following query functions since they are not allowed: “LIKE” clause, “IN” clause, and “NOT NULL” clause
  • The need to use && instead of AND in queries
  • Setting multiple query parameters
  • Using the PersistenceManager in a chain of Servlets and JSPs

Recommendations – Transitioning from other Java programming environments to Google App Engine for Java should be effortless but there are some quirks that require adjustment. The following recommendations address some of the quirks:

  • Google Accounts for Authentication – If you use Google Accounts for authentication then encapsulate Google’s User object inside a persistent object such that a minimal amount of code depends on it. This is important because Google’s User object is subject to change and currently does not provide a primary key.
  • One-to-Many Relationships – Use written queries to load one-to-many relationships if you are struggling to define one-to-many relationships with JDO annotations. The App Engine Data Store has limitations that do not allow it to support the full JDO specification.
  • Servlet Filters – In lieu of a framework like Struts 2 or Spring, use Servlet Filters to implement features that span several pages including user authentication and database connection management. For example, in a single HTTP request you can “get” a persistent manager multiple times but cannot close a persistent manager more than once so I recommend creating a Servlet Filter that initiates a connection but is the only place where a connection is closed.
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
     if (filterConfig == null){ return;}
     PersistenceManager pm = PMF.get().getPersistenceManager();
       chain.doFilter(request, response);
     } finally {

  • Version management – Version management is limited to 100 versions for each application so only change your application’s version number when making a database change (i.e., adding and removing columns or tables).
  • Localize Data – Store lookup data as static arrays (or collections) to minimize database queries since Google charges for database storage space and CPU processing time.
  • Auto Generate Query Indexes – Write automated tests against your development server that trigger every possible query your application needs to run in production because App Engine for Java can auto generate the datastore index file that is required to configure your production database. Manually writing the datastore index file is cumbersome and error prone.
  • Development Server – Stop your development server from Eclipse’s debug mode (this took me a while to figure out).

Note: If you like this article, make sure you check out 3 Tips For Getting Started with Google App Engine for Java.

Robert Miller is a technology entrepreneur specializing in e-commerce and online services that integrate with social networks and mobile devices. He blogs at PardonTheInformation and you can also subscribe to his feed.

Facebook Share Button
If you liked this article, please take this time to share it with your Facebook friends using the Facebook button (see Facebook post button to the left) or retweet it using Twitter (see retweet button to the left). You may also want to follow us or subscribe to the site to stay up-to-date with this article. If you'd rather follow us from your Facebook account, join our Facebook fan page or subscribe to our NetworkedBlogs profile.

Please Tweet, Bookmark, or Share This Free Content Using These Services:

Enter your email to subscribe to our RSS feed. What is RSS you ask?

Related Articles You Are Probably Interested In: