logo

Getting Sitemesh running on Google App Engine

logo

I’ve been having a ball playing with Gaelyk for developing Google App Engine applications in Groovy. One thing that Gaelyk lacks (for now! It’s only 0.3.x) is any kind of layout engine like Sitemesh. No probs, just add then the Sitemesh filter to your web.xml and you’re off, right?

    <filter>
        <filter-name>sitemesh</filter-name>
        <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>sitemesh</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

Well that would be wonderful! However Sitemesh 2.4.1 has some integration points with JNDI that will bring you a world of hurt (Error 500) along with a description in your app engine logs. It will work locally, but fail once deployed. For later googlers, here’s the strings from the appengine logs:

Error for /
java.lang.NoClassDefFoundError: javax.naming.InitialContext is a restricted class. Please see the Google App Engine developer's guide for more details.
	at com.google.apphosting.runtime.security.shared.stub.javax.naming.InitialContext.(InitialContext.java)
	at com.opensymphony.module.sitemesh.Factory.getEnvEntry(Factory.java:91)

Fortuntely some kind soul has documented the fix for that Factory class already. Followed those instructions and I was in business.

Now, onto some more DataStore experiments with Gaelyk…

4 Responses to “Getting Sitemesh running on Google App Engine”

  1. Actually, SiteMesh 2.4.2 was fixed and works well on App Engine:
    http://joewalnes.com/2009/04/17/running-sitemesh-on-appengine/

    And (although I’ve not tried it yet), I think SiteMesh 3 (still alpha as the author says) is certainly working out of the box as well without any fix either.

  2. Glen Smith says:

    Wow! My bad…. it seems that the active fork of sitemesh is now at java.net (https://sitemesh.dev.java.net/). But the standard downloads (http://www.opensymphony.com/sitemesh/) don’t point over there. Bugger.

    Oh well. I’m glad there’s an official version to work off. Thanks for setting me straight!

  3. javafuns says:

    hi
    I too tried sitemesh on appengine these days. But found velocity does’t work on appengine.
    Have you guys tried velocity on appengine ?

  4. Glen Smith says:

    Sorry mate. Haven’t done anything with Velocity. There is a page on which libraries are known good with app engine http://groups.google.com/group/google-appengine-java/web/will-it-play-in-app-engine. Can’t see Velocity there though.

logo
logo
Powered by WordPress | Designed by Elegant Themes