Making Clojure really work with Google App Engine

Skip to first unread message

Constantine Vetoshev

Sep 19, 2010, 9:10:05 PM9/19/10
to Clojure
I recently spent some time trying to abstract away some of the
incidental complexity of using Google App Engine with Clojure. Right
now, setting up interactive development and understanding what to do
requires reading several blog posts, and pasting in a lot of
boilerplate code. I ended up making a small library, called appengine-
magic, which cuts the boilerplate down to (1) a single additional .jar
dependency, (2) a couple of macros, and (3) a couple of files
generated by a Leiningen plugin. It takes a Ring handler, and turns it
into an application suitable for App Engine.

It doesn't do everything yet, but I feel that it already makes a much
easier starting point than any alternative. The README file explains
the details.

Unfortunately, I hit a major stumbling block. Live deployment to App
Engine does not work because of a dependency importing a blacklisted

appengine-magic expects to deploy a Ring handler. This makes it
possible to write apps using any Ring-compliant Clojure web framework.
In order to deploy to App Engine, it needs to turn the handler into a
servlet. The ring-servlet library does this with its handy
ring.util.servlet/defservice function. The implementation of
defservice uses duck-streams/copy. duck-streams imports, a class blacklisted by App Engine, causing deployment
to fail.

So any innocuous dependency, which transitively depends on anything
which loads a file which imports a blacklisted class, can cause
deployment to fail. Even Clojure itself is not entirely safe: for
example, duck-streams is now, which imports

I can reimplement defservice, and so avoid depending on ring-servlet.
Still, the situation seems fragile and precarious. Suggestions and
comments welcome.

Stefan Kamphausen

Sep 20, 2010, 9:17:07 AM9/20/10
to Clojure

just a few days ago I started considering GAE for a (pet-)project.
Being able to develop in Clojure on GAE seems like a valuable goal to
me. For example, take a look at which
was written that way.

So it might be a good idea to avoid creating threads automatically or
importing file/socket packages.

Anyway, just my 2ct.

Kind regards,

Constantine Vetoshev

Sep 20, 2010, 4:03:52 PM9/20/10
to Clojure
On Sep 20, 9:17 am, Stefan Kamphausen <> wrote:
> So it might be a good idea to avoid creating threads automatically or
> importing file/socket packages.

I think you're right. Dependencies are always a double-edged sword,
and in the case of App Engine, they are more toxic than usual. Anyway,
I eliminated the ring-servlet dependency, and appengine-magic now
successfully deploys simple "hello world" Ring applications. I'll send
a more formal announcement to the mailing list shortly.
Reply all
Reply to author
0 new messages