Upgrading to Java 7 on Google’s AppEngine

If you are still running a Java 6 application on Google AppEngine, you’re about to get into serious trouble. Any moment now, the AppEngine team is going to release version 1.8.9, which will no longer support deployment of Java 6 applications.

Existing applications will keep on running. But you should probably upgrade your application with the necessary urgency, as you will no longer be able to fix bugs.

More Maintenance

Most PaaS providers will very regularly update their platform to keep up with the latest security fixes and to add on new services and APIs. In this regard AppEngine takes a pretty radical approach. They do not wait for their customers when they think removing old code is the right thing to do.

These updates will usually be backwards compatible, but, given enough time, there will be updates that break old code. Java 7 is backwards compatible with Java 6. But some libraries are not.

A Good Thing?

I try to see this maintenance work as a good thing. It forces you to keep up with the latest technology, which, as far as I’m concerned, is mostly important from a security standpoint.

Upgrading to Java 7 on Google’s AppEngine

So lets get into the details. In most cases, this upgrade will be as simple as changing the JDK that you use to build and deploy to AppEngine. In my case, it wasn’t.

The major problem was that some part of the JDO/DataNucleus/AppEngine combination I was using, did not work with Java 7. According to all of their respective pages, this should not be problem, but it just didn’t work with runtime errors that indicated incompatible versions.

I had been wanting to upgrade DataNucleus anyway, so I thought “Why not?” It turned into a prolonged session of yak shaving.

First, upgrade appengine-datanucleus, the integration library between AppEngine and DataNucleus. There are currently 3 versions. Only the latest version is using non-deprecated code. Sadly, this version is (as far as I know) not officially release yet. So after much  consideration, I ended up picking version 2.1 (I hope to get rid of JDO in favor of Objectify this year)

Next I found out that this also means I need to migrate the datastore content. This is not very well documented at all. Even if you manage to find that wiki article, it’s using old libraries. I was unable to get this working on my project and didn’t have the time nor willpower to figure out the new mapreduce framework for AppEngine.

Eventually I created a small task queue that could perform the upgrade. Luckily the number of entities was small enough that this worked. If you have a larger dataset, you will probably already know how to use mapreduce anyway.

With that out of the way, there were still a few small bugs popping up.  All of them were caught by my unit tests. For instance, it turns out that loading an empty collection from the datastore may now return null instead of an empty collection. Small thing to fix, but it would be nice if this was documented somewhere.

Conclusion

Make sure you take your time to do the Java 6 to 7 upgrade on AppEngine. It’s probably going to be transparent for you, but what if it isn’t?
 

Reference: Upgrading to Java 7 on Google’s AppEngine from our JCG partner Peter Backx at the Streamhead blog.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


three + 2 =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close