Google App Engine, Stripes, and SpringPosted: 4 October 2009
Some glitches and snags I ran into when moving my sample Stripes application to Google App Engine, aka GAE. Nothing major, as it turned out.
In web.xml the url-pattern in servlet-mapping can’t have newlines in it:
In the pom, don’t depend on the entire spring jar, but pull in the bits you need; spring-beans, spring-context, spring-web, etc.This didn’t fix the problem for me, so I resorted to the next item.
- You need to use Spring 3; Spring 2.x uses a JNDI exception and JNDI classes are disallowed on GAE.
In your pom make the scope for jstl provided. taglibs:tandard shouldn’t be needed with jstl 1.2.Not sure why I thought that was necessary but it breaks things when you try to run your app under the embedded Eclipse Tomcat, although I’m not sure if it’s reasonable to expect that to work since I should be using the Google App Engine Eclipse plugin’s embedded web server.
- On windows you need to fix the system environment PATH so that the java jdk bin is at the beginning. You can’t do it for the user environment since the system path is prepended to the user’s, and the system path includes a jre java.exe but you need to use the jdk java.exe. This is only necessary if you’re using GAE’s scripts to test and deploy your app, appcfg.cmd and dev_appserver.cmd. If you’re using the GAE Eclipse plugin then don’t worry about this.
In the jsp files you need to set isELIgnored to false:
<%@ page contentType="text/html;charset=ISO-8859-1" language="java" isELIgnored="false" %>
This seems rather wacko to me; perhaps it’s because I have the version set to 2.5 in my web.xml?
For Stripes you need a fake/stub implementation of
net.sourceforge.stripes.controller.multipart.MultipartWrapperFactory because the Stripes one tries to create or access a file or directory and that doesn’t work on GAE. Yours can provide an empty init() method. You’ll need to add an init param in the web.xml for the Stripes filter. The Stripes web site documents how to do this. This means you can’t do file uploads on GAE. See this link for ideas if you need to solve that problem.
See also Omer Haderi’s entries, in particular, the links at the bottom.