May 20, 2010

Debug BlazeDS Tomcat Server in Eclipse!!!

Warning: this post is dripping with awesome. Once you're able to get this working, you might go dancing in the street (I know I did!). Consider yourself warned.

Problem

You need to debug java code running on Tomcat as part of BlazeDS. You want to do this in Eclipse.

Symptoms

  • You're tired of using logs, system outs, or other tom-foolery to debug the server-side code for your Flex application!
  • You tried to set this up but received the following error:
  • java.lang.NoSuchMethodError: org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent.clearCache()V
  • You'd like to set a breakpoint and have server execution stop and jump to your breakpoint, even while executing RemoteObject code from Flex
  • Once you hit such a breakpoint, you want to be able to inspect variables and expressions and enjoy similar debugging pleasures

Solution

Note: In this process, I encountered the very common error:

java.lang.NoSuchMethodError:

org.eclipse.wst.common.componentcore.internal.resources
.VirtualComponent.clearCache()V

Fixing it simply required updating eclipse.

I'll summarize the steps to getting debugging tomcat in eclipse to work as follows:

  1. Open the Server View, right click and create a New Server
  2. Point it to your /blazeds/tomcat folder (do not add any projects yet)
  3. Right Click the new server and choose "Open"
  4. Make sure your settings match this screenshot
  5. NOTE: if the "Sever Location" section is disabled, that means you added a project in step 2. Delete this sever and start over without adding any projects.


Better yet, just follow this excellent and detailed blog titled Setting up your BlazeDS (tomcat) server on Eclipse ( local ). It worked flawlessly.

I credit the FlashBandit blog with opening my eyes to the fact that Setting Up a Basic BlazeDS Server with Debugging was even possible.

No comments:

Post a Comment