Apache Wicket on Google App Engine for Java

Holy smokes, that was easy. I\’ve got a basic Wicket app running on Google App Engine in under 2 minutes.

3 small traps for the unwary. First of all, you need to enable sessions in your appengine config file.

    true

Secondly, add the following line into your WebApplication\’s init() method:

    @Override
    protected void init() {
        super.init();
        
        //remove thread monitoring from resource watcher
        this.getResourceSettings().setResourcePollFrequency(null);
    }

Thirdly, override the newSessionStore() method to return HttpSessionStore, because the default second level session store uses java.io.File, which Google App Engine doesn\’t allow:

    @Override
    protected ISessionStore newSessionStore()
    {   
        return new HttpSessionStore(this);
//      return new SecondLevelCacheSessionStore(this, new InMemoryPageStore());
    }

That\’s because Google App Engine doesn\’t want you spawning threads. Obvious enough.

So that\’s it! You\’re in a Wicket-land of infinite scalability…

(I\’m sure there\’s more to it but I was excited…)

See my stupid test here: http://transitplatform.appspot.com/

14 Replies to “Apache Wicket on Google App Engine for Java”

  1. Marvelous ! I just read about GAE/J and searched for someone who tried wicket and here you are. Thanks.
    I think wicket is perfect for that platform.
    Really good news.
    thanks

  2. Hi thanks for sharing the infos!

    Currently I’m having some difficulties whith wicket having loading the html resources.

    Did you change anything appart from the mentioned overrided methods?

    cheers

    Logs:

    Apr 17, 2009 12:45:03 AM org.apache.wicket.util.resource.locator.ResourceStreamLocator locateByResourceFinder
    FINE: Attempting to locate resource ‘org/gaetest/pages/HomePage.html’ on path [folders = [], webapppaths: []]
    Apr 17, 2009 12:45:03 AM org.apache.wicket.util.resource.locator.ResourceStreamLocator getResourceStream
    FINE: Attempting to locate resource ‘org/gaetest/pages/HomePage.html’ using classloader com.google.appengine.tools.development.IsolatedAppClassLoader@31ff23
    Apr 17, 2009 12:45:03 AM org.apache.wicket.util.resource.locator.ResourceStreamLocator getResourceStream
    FINE: Attempting to locate resource ‘org/gaetest/pages/HomePage.html’ using classloader com.google.appengine.tools.development.IsolatedAppClassLoader@31ff23
    Apr 17, 2009 12:45:03 AM org.apache.wicket.util.resource.locator.ResourceStreamLocator getResourceStream
    FINE: Attempting to locate resource ‘org/gaetest/pages/HomePage.html’ using classloader com.google.appengine.tools.development.IsolatedAppClassLoader@31ff23

    SEVERE: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    Apr 17, 2009 12:45:03 AM org.apache.wicket.RequestCycle logRuntimeException
    SEVERE: Markup of type ‘html’ for component ‘org.gaetest.pages.HomePage’ not found. Enable debug messages for org.apache.wicket.util.resource to get a list of all filenames tried.: [Page class = org.gaetest.pages.HomePage, id = 0, version = 0]
    org.apache.wicket.markup.MarkupNotFoundException: Markup of type ‘html’ for component ‘org.gaetest.pages.HomePage’ not found. Enable debug messages for org.apache.wicket.util.resource

  3. Really been trying this but can’t get it working in the app engine. It works fine in Eclipse but on Google I get a 404 – so I wonder where the difference is.

  4. Hi

    I agree that it works fine in Eclipse using the Google appengine plugin, but after deplyoying to Google the first page was ok, but trying to simulate some other pages I get this error: 500 Server error
    and the logs is:

    Uncaught exception from servlet
    com.google.apphosting.api.ApiProxy$RequestTooLargeException: The request to API call datastore_v3.Put() was too large.

    any idea?

    regards

  5. i had to add serialVersionUID to my wicket pages since they are stored in the session and serialized. I guess they are not required by Eclipse when I create a wicket page. before i did that, i was receiving an exception like:

    javax.servlet.ServletException: java.lang.RuntimeException: java.io.InvalidClassException: wicket.LoginPage; local class incompatible: stream classdesc serialVersionUID