The Vaadin Wiki is temporarily in read only mode due to large recent spam attacks.
Google AppEngine HOWTO
Google provides a scalable application hosting environment called Google App Engine (GAE). One of the many benefits of GAE is that hosting small scale applications is 100% free. Google starts charging for hosting when your application resource requirements start to grow.
Step by step #
Install the Vaadin Eclipse Plugin #
- Install or update the Vaadin Eclipse Plugin to version 1.0 or newer. For more information see http://vaadin.com/eclipse.
Install Google App Engine Plugin for Eclipse #
Create and deploy Vaadin project for Google App Engine #
- Create a new Vaadin project as described in the Book of Vaadin
- Select "Google App Engine servlet" as deployment type.
- Select to use Vaadin version 6.3.0 or newer. click "Download..." if it is not in the list.
- Enable GAE
- In project preferences check "Use Google App Engine" in Google/App Engine.
- Click the "My applications..." link
- Log into your Google App Engine account
- Create a new web application in "My Applications" list
- Add created the application id to your project configuration in Eclipse
- Code and configure your application.
- Deploy to App Engine by clicking the project with right mouse button and selecting Google/Deploy to App Engine, or click the "Deploy to App Engine" icon in the toolbar.
- Run the application in http://yourapplicationid.appspot.com/
Note! There is a problem in the latest GAE plugin which prevents this from working. If you get an error like "The App Engine SDK 'C:\<workspace path>\<project name>\war' on the project's build path is not valid" do the following:
- Open preferences -> Google -> App Engine and select the sdk version again
- Open prefercense -> Java Build Path -> Export Order. Change the Export order so that the App Engine SDK is ABOVE the "Web App Libraries" classpath container.
If you want to deploy the application in a normal servlet container outside GAE, always use com.vaadin.terminal.gwt.server.ApplicationServlet instead of com.vaadin.terminal.gwt.server.GAEApplicationServlet.
Even though Google App Engine development environment is able to run your app locally, the execution environment differs a lot from the the real deployment environment. As a result, you often end up with the situation that the app runs locally without a problem, but doesn't in the cloud.
Your application and all classes it refers to must be serializable. Google App Engine serializes the session between each request and the application and all components are stored in the session. By extending a Vaadin class your class will automatically be serializable.
- Data classes referred to must also be serializable
- Never use "new Object()" to make a unique identifier as Object is not serializable.
To achieve the best performance, do not serve static files through the servlet. By default the widgetset and the theme is served through the servlet, which is nice for any other server than Google App Engine. In order to serve theme and widgetset outside the servlet, extract VAADIN directory from vaadin.jar to your WebContent. Note however that if you are using the free version of Google App Engine, there is a file limit which you may exceed if you have a large theme and/or widgetset and serve them statically.
Distributed execution environment #
Note that the server, the JVM where the servlet is running and basically everything will change from request to request. This means that you cannot count on that a static which is set during handling of one request will be set when handling the next request.