AppEngine, JRebel and Eclipse - Getting them to work together

Wednesday, 29 September 2010

I recently started using JRebel for development, but initially I had a bit of trouble getting it to gel with the App Engine / Eclipse setup. After an email or two with the guys at Zero Turnaround I finally got it to work, and it's well worth the effort. Here is a guide for what you need to do...

  1. Install JRebel, the latest version for your platform.

  2. Get into Eclipse and install the JRebel Eclipse Plugin using the "Install New Software..." link under the Help menu, and add the JRebel Update site...

    I specified the "JRebel Eclipse Debugger Integration" and "JRebel Eclipse Integration only" components.

  3. Specified the jrebel.jar in Eclipse / JRebel preferences. (Mine was in my C:\Program Files\ZeroTurnaround\JRebel\jrebel.jar folder.

  4. The installation Wizard provided with JRebel provides you a guide to get it working in Eclipse. Make sure you go through those steps. (...adding org.zeroturnaround.* etc in Eclipse preferences)

  5. Modified the dev_appserver.cmd, which on my PC sat in


    Here is it's contents:

    @java -cp "%~dp0\..\lib\appengine-tools-api.jar" ^ ^
    --jvm_flag=-javaagent:%REBEL_HOME%\jrebel.jar --jvm_flag=-noverify ^

  6. Now you need to add this to the VM Arguments for your Run configuration for your App Engine application:
    -javaagent:/opt/jrebel/jrebel.jar -noverify
    Again, make sure this points to your jrebel.jar location.

  7. Once you've modified the VM Arguments in the app run config then you should see the JRebel text appear in the console.

  8. By the way, you don't need to execute your application in Debug mode to get JRebel to work. If you modify a file in Debug mode you'll still get the "Hot Code Replace Failed" message.

  9. To test I simply booted up the app, and added a method to a class and called it - You'll see a message in the console saying that JRebel is reloading the class.

Now enjoy a considerably quicker method of developing / deploying App Engine apps. $59 bucks is well worth it!

I'm hoping the team at Zero Turnaround turn their attention to Android's Dalvik VM next. JRebel would be of HUGE benefit to developing Android apps and I'm sure with the amount of Android developers out there at the moment it would be a big money spinner for them too.

Wicket and App Engine - How to avoid loading Wicket on startup

Thursday, 23 September 2010

A GAE app of mine ( which is a backend to an Android app that most requests come via other code rather than through Wicket. Wicket is my chosen framework which I use to display the front-end of the application (the website!). And most of the requests to the application does not require wicket.

As I'm sure many GAE users know, the startup time is a big problem especially for low traffic apps, and having to load a framework such as Wicket on startup is damaging to the request time for an App.

To avoid having to start the WicketFilter every time the app starts I have extended the WicketFilter to only initialize when the first Wicket page is hit:

public class RequestWicketFilter extends WicketFilter
   private static boolean  requestMade = false;
   private static boolean  initialized = false;
   private static FilterConfig fConf;

   public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException
      if (!requestMade)
         requestMade = true;

         super.doFilter(req, res, chain);

   public void init(FilterConfig fC) throws ServletException
      if (fConf == null)
         fConf = fC;

      if (requestMade && !initialized)
         initialized = true;