Tuesday, July 21, 2009

Upgrading App Engine + Spring 3 from 1.2.1 to 1.2.2

We ran into a few pitfalls during our upgrade from GAE/J 1.2.1 to 1.2.2. Here are the things we were forced to address in the upgrade:

1. Remove the Default Servlet

In web.xml, we configured the default servlet to map /static/** to static resources. This looked like:


<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>*.png,*.jpg,*.css,*.js</url-pattern>
</servlet-mapping>


Upon upgrading, this threw an exception:


2009-07-21 17:06:16.104::WARN: Failed startup of context com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@137d090{...}
java.lang.IllegalStateException: No such servlet: default


The solution was to simply remove the default servlet mapping entirely. Apparently, this functionality has been incorporated into GAE by default.

2. Update unit test local environment

Google modified the ApiProxy.Environment interface in the update to 1.2.2. Since the release, Google has updated their unit testing guide to reflect this change. There is a discussion of this change here.

3. Update test jars

Our unit tests still did not successfully run after making the change described above - JDO queries would return no rows. It turns out that the two testing files (appengine-api-stubs.jar and appengine-local-runtime.jar) were upgraded in the API release. After updating these files, everything was working fine.

We also renamed these files to appengine-api-stubs-1.2.2.jar and appengine-local-runtime-1.2.2.jar to avoid future confusion.