Dan WalmsleyCoding so you don't have to

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.

    <sessions-enabled>true</sessions-enabled>

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/

This entry was posted in General and tagged , , , . Bookmark the permalink.

14 Responses to Apache Wicket on Google App Engine for Java

  1. Garidan says:

    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. Al says:

    dude!!, publish the source!!

  3. Ai says:

    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

  4. Per says:

    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.

  5. Tee Bee says:

    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

  6. bob says:

    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

  7. Pingback: Problems When Deploying Working Application on Google App Engine « Inphina Thoughts

  8. Pingback: Generating Excel Files On Google App Engine For A Wicket Application « Inphina Thoughts

  9. Pingback: Improve Performance By Using Keys Only Query on Google App Engine « Inphina Thoughts

  10. Pingback: Managing Wicket Serialization Problem On Google App Engine « Inphina Thoughts

  11. Pingback: Managing Wicket Serialization Problem On Google App Engine « Making a better world with enterprise Java

  12. Pingback: Improve Performance By Using Keys Only Query on Google App Engine « Making a better world with enterprise Java

  13. Pingback: Looking at MVC frameworks « cg2p

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

Browse by Topic