Google App Engine#

Resources#

JDO Resources#

Apache DB HomeDatanucleus Home Java API Comparing JDO/JPA

Intro#

Before you sing-up (agreements here(info)), they require you have a mobile number:

To create applications with Google App Engine, you need a verification code. ....
The verification code will be sent to it via SMS. Note you will only need to verify your account once.

Install / Test#

  • Install the Eclipse plugin
  • sudo apt-get install libstdc++5

First Deployment#

I registered my first app with the ID computerhok01, so you can access it at http://computerhok01.appspot.com

Compiling module nl.computerhok.gae.test1.GAEtest1
   Compiling 5 permutations
      Permutation compile succeeded
   Linking into war
      Link succeeded
   Compilation succeeded -- 26.989s
Creating staging directory
Scanning for jsp files.
Compiling jsp files.
Compiling java files.
Scanning files on local disk.
Initiating update.
Cloning 30 static files.
Cloning 65 application files.
Uploading 31 files.
Uploaded 7 files.
Uploaded 14 files.
Uploaded 21 files.
Uploaded 28 files.
Deploying new version.
Will check again in 1 seconds
Will check again in 2 seconds
Closing update: new version is ready to start serving.
Uploading index definitions.
Deployment completed successfully

Application life cycle management#

A very nice feature of GAE is the way they manage deployed applications.
If you deploy an application, you can assign a version number (in Eclipse), if you deploy a new version, both the old and the new applications are available.
You can manage these application versions on the GAE console (see Administration Versions).

So you can simultaneously access both applications, for example with the following urls :

Quota #

Here's a screenshot of the Qouta details page:

GAEQuota.png

Things noticed / experiences#

HttpSessions#

  • HttpSessions should be enabled in appengine-web.xml, The implementation uses the App Engine datastore and memcache to store session data.
  • make sure that all objects in the session are Serializable (test environment accepts it, but GAE not)
  • changing names of classes/packages of objects that were in the session earlier will cause problems:
Caused by: java.lang.ClassNotFoundException: nl.computerhok.gae.test1.dao.Peuter at com.google.appengine.runtime.Request.process-e0ffd4c85af8f259(Request.java) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at java.util.HashMap.readObject(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at com.google.apphosting.runtime.jetty.SessionManager.deserialize(SessionManager.java:385) ... 35 more You only get into the application using the version identifier in the URL, like http://3.latest.computerhok01.appspot.com/

java.net.InetAddress#

Oops, not supported, you even get a compile error in your workbench, so you don't get to know the hostname of the host your request was handled on.

(no) log4j#

If you start using log4j in your webapp (and you added a log4j.jar to war/WEB-INF/lib and to your project's build path), JDO enhance ant task fails with a NoClassDefFoundError. Few hits on Google on that, finally removed log4j all together and switched to Java util logging.

Datastore#

  • The datastore does not support the SQL language, you can only use JDOQL, for example, this is not supported :

Query query = getPersistenceManager().newQuery(Query.SQL, queryString);

Only one property per query may have inequality filters (<=, >=, <, >).. So you cannot do something like :

SELECT * FROM Peuter where geslacht>'M' AND achternaam>'b'

Case insensitive queries ?

What happens if you first create some entities, and then you add additional persistent fields ("columns") to the class ?

Well, that's nice, that simply works, tested by adding an adres field :-)

#