2011-01-27

Using NetBeans to develop for Google App Engine

Google App Engine (GAE) is a kind of servlet container or application server that runs in Google's server cloud and enables you to host high available web apps for free. At least if the app's usage does not get too high.

If more than appx. 5 million pages are served per month you will need to pay for additional bandwith, cpu time and memory.

This posting is a how-to on comfortably developing and testing web apps for Google App Engine (GAE) using the OpenSource IDE NetBeans.

First download the latest (currently v1.4.0) GAE SDK for Java and unzip the archive. Don't use the Python SDK, as NetBeans is a Java program.

A plugin for NetBeans exists that adds GAE as a server to the IDE so you can deploy your project with just one click. Unfortunately the plugin developers on kenai.com didn't recompile the plugin yet for the current NetBeans release 6.9. In this case you have to download the 3rd party rebuild. Then use the Tools menu to open the Plugins window. Select the Downloaded tab and click the Install button.

Now use the Tools menu again to open the Servers window. Check which ports are already used by e.g. tomcat and your other servers. If you use a different port number for the GAE server this will have the advantage that you can run different types of servers simultaneously.

Now have a look a the screencast from the plugin authors, embedded below this paragraph, to see how you enable the GAE server. Right after the start of the process you have to select the directory where you unzipped the GAE SDK you previously downloaded from the GAE web site.
Later on the screenscast shows you how to create your first GAE project.


Before you can deploy an application to Google App Engine you have to create a GAE account, if you don't already have one. You can use any Google Account (e.g. your Google Mail account) for that or create a new one. A mobile phone is required as Google will send you a SMS with an authentication code you have to enter on the web page.

After your first login to the GAE dashboard Google offers you to create your first GAE application. Just do it now, because not every name is allowed or may even be already taken, because currently all projects are mapped to subdomains of appspot.com. Later you can add more applications on appspot.com. Up to 10 apps per account are currently allowed by Google.

Now right click on your project and select "Deploy to Google App Engine" as shown at the end of the video. The plugin will ask you once for your GAE account's email address and password. Then the application is deployed and can be used on http://appname.appspot.com
Please note that the deployment will fail if you did not create the application before on the GAE dashboard as described above. The application name in the dashboard has to match the one that is configured in /WEB-INF/appengine-web.xml. I suggest to use the same name for your NetBeans project to keep things simple.

Check back to the GAE dashboard and select your application to get all sorts of information about the usage, logging, and so on.

2011-01-26

Welcome to my blog!

To reach a wider audience I've decided to maintain this English blog in addition to my existing German blog which is also always reachable using the maschinenwerk tab on top of this page.
The main focus of this blog are IT related topics like software development or system administration. Enjoy reading!