Create a GAE account
>Install GAE SDK
Prepare your Java application for GAE
<?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application>wicket-charts</application> <!-- Version must only contain letters, hyphens ("-") and numbers! Otherwise, a HTTP 500 will occur on update --> <version>1-2-0</version> <threadsafe>false</threadsafe> <sessions-enabled>true</sessions-enabled> <system-properties></system-properties> </appengine-web-app>
Take care that the content of the version tag contains only letters, numbers or hyphens (no periods!). Otherwise you get an inexpressive HTTP 500 error when deploying the application.
Additionally to providing a depoyment descriptor you have to adhere to some restrictions GAE imposes on java applications. The main restrictions are:
- Your application may not store anything in the local filesystem (which actually already is a constraint of the servlet API, but most application servers do not enforce this rule)
- Your application may not use all classes of the JRE. For example, AWT/Swing classes are a no-go for GAE applications. The classes you may use are listed in a white list.
The second restriction is by far the more constraining. You simply cannot run an application on GAE that uses one of the prohibited classes! This makes the deployment of applications built without GAE in mind a gamble.
Prepare your Wicket application for GAE
The steps above are valid for all Java applications. For making a Wicket application ready for GAE, simply put the Google App Engine Initializer in the classpath of your application and you’re done. The initializer will automatically configure your Wicket application on startup so that it adheres to the GAE restrictions. Among other things, the initializer configures your application not to use Wicket’s DiskDataStore which stores the PageMap in the file system.
If you want to have full control over how your Wicket application is configured, you have to make the necessary configurations in your application’s init method yourself (but you have to find out yourself what configurations are necessary for the application to run on GAE).
Deploy your application on the GAE development server
To test if your application runs on GAE, run the following command:
where points to a directory (expanded war archive) and not a war file.
On http://localhost:8080 you should now see your application.
Deploy your application into the GAE cloud
To finally deploy your application to the cloud, run the following command:
<path_to_appengine_sdk>/bin/appcfg.cmd update <path_to_your_war>
where again points to a directory. You will be prompted to enter your GAE login credentials before the application will be uploaded.
You should then be able to access your application on http://.appspot.com.