NetBeans development Series for Google App Engine for Java (2)
By leonfan on Apr 16, 2009
In previous article, we talk about how to create a new project in NetBeans. Here we will try to make it final work for App Engine.
- Put dependency class libraries for 'compile' task
- Copy all of those libraries to deploy directory
- Create some task to make debug ready
- Make those xml files ready for JDO/JPA enhancement
Here is my build.xml file, It worked on my environment. I map test action to 'debug' as there is no debug item there for map:
Please remember to update propery 'appengine.sdk' accourding to your environment, and keep in mind that I put third-party jar files under '<Project Base>/lib' directory.
Now, most of things are ready in NetBeans, you can create application and run/debug it in NetBeans now.
How to create Servlet
You can new a Servlet after right click on project. NetBeans couldn't auto generate information in web.xml for free-form and you just need go to web.xml and manully did servlet/url mapping like this:
That's different thing for Servlet support.
How to debug application for Google App Engine
Since we already map 'test' action to 'debug', we should right click on project and choose 'test' to do debug'. When system is running and listenning on Java remote debug port 5005, attach debugger under menu 'Debug':
I remove datanucleus-enhancer-1.1.1.jar under directory 'lib' as there have duplicated one under 'lib\\user\\orm'. It will cause duplicated registration error during enhancement.
How to stop running container
We need manully kill it outside of NetBeans. We can use 'kill' on Unix and 'Task Manager' on Windows to kill that java process. I bet you won't make mistake to kill NetBeans process as it use more memory than that container's. You need finish debugger session in NetBeans first if you are debugging it.
Now, we can easily debug Servlet/JDO/JPA in NetBeans. You can download NetBeans here!