Archive for the Category 'eclipse'

This Week in Grails (2010-51)

Saturday, December 25th, 2010

Update: Check out the traducción al español

Update #2: Check out the Portugese translation

Update #3: Check out the Chinese translation: Grails每周观察

Happy (belated) Festivus to you all.

A few notes first. I missed an item last week, Peter Ledbrook’s writeup of the cool stuff he’s working on at Also, if you want to keep up with these “This Week in Grails” posts you can access them directly via their category link or in an RSS reader with the feed for just these posts.

Miscellaneous Items


There were 8 new plugins released:

There were also several updated plugins:

  • ajaxflow version 0.1.10. Enables Ajaxified Webflows
  • cache-headers version 1.1.3. Improve application performance with browser caching
  • chargify version 1.0. Integration with
  • greenmail version 1.2.2. Support for email testing with GreenMail
  • grom version 0.2.1. Sends notifications on Windows, Linux, and Mac
  • jquery-validation-ui version 1.0.1. Client Side Validation without writing JavaScript
  • maven-publisher version 0.7.4. Publish Grails projects and plugins to local and remote Maven repositories
  • multi-tenant-spring-security version 0.2.0. Integrates the multi-tenant plugin with the spring-security-core plugin
  • ofchart version 0.6.2. Open Flash Chart Plugin
  • resources version 1.0-RC1b. Improved handling for static resources (JS, CSS, images, etc.)
  • routing version 1.1.0. Integration with Camel
  • routing-jms version 1.1.0. JMS/ActiveMQ support for the routing plugin
  • springcache version 1.3. Caches Spring bean methods and page fragments generated by Grails controllers
  • zk version 1.0.1. Adds ZK Ajax framework ( support to Grails applications
  • zk-ee version 1.0.1. Enterprise Addons for the ZK plugin

Interesting Tweets


This Week in Grails

Friday, December 10th, 2010

Update: Check out the Chinese translation

I tend to see a lot of Grails and Groovy related items in my RSS reader, a couple of Twitter keyword searches, the Grails User mailing list, and miscellaneous other places, so I thought it’d be good to aggregate some of the useful and/or interesting items that I find each week to hopefully give them a little more visibility.

I also wrote a small Groovy script to find the most recent plugin releases and updates since they don’t always get announced.

Miscellaneous Items

  • Upcoming Grails 1.3.6 release

    • The 1.3.6 release should be next week once testing is finished. There are lots of fixes and improvements in this release – check out the partially-finished release notes. The code is very stable at this point so you’d help us out a lot by installing the latest build from our CI server and testing it with your application and letting us know if there are any issues.
  • Ted Naleid’s run-script

    • We had a request to add this cool script to the Grails core scripts and that will be released in 1.3.6. It makes it easy to run a Groovy script that access your domain classes, services, Spring beans, etc.
  • MinuteProject 4 Grails

    • This is an interesting reverse engineering project that supports Grails and several other frameworks. I haven’t looked at it extensively yet but it looks like it does a lot of what my Database reverse engineering plugin does but also generates a scaffolded user interface.
  • Updated Grails logging configuration documentation

    • Peter Ledbrook added a bunch of information to the logging configuration section of the Grails user manual and published a draft here
  • GroovyTestCase uses java.util.logging.Logger

    • Integration tests typically extend GroovyTestCase which has a protected log variable. Unfortunately it turns out that this is is a java.util.logging.Logger but Grails uses Log4j, and this can cause logging statements to seem to disappear and cause confusion when running tests.
  • Testing Closures in Groovy

    • This is an interesting post by Scott Vlaminck using a tracking delegate to help with testing Closures.
  • SAP SDN Blog Reader for iPad, iPhone and Android devices

    • Blog post about using Grails to write a mobile feed reader application
  • Grails 400 Retail Site

    • Developing a Grails e-commerce site using a DB2/400 database on an iSeries/AS400 box
  • QuickHit is hiring

    • QuickHit is hiring a Grails lead developer in Foxboro, MA. They run a popular Grails-based site that hosts realtime football games using Flash.
  • Updated STS Integration docs

  • Mystery Grails site launch

    • Unfortunately I can’t share any details about this one, but a large web site went live this week with their site updated to be entirely Grails-based. It looks great and performance is fantastic. Hopefully more information will be forthcoming once they officially announce the update.
  • Speaking of large sites using Grails …

    • Check out the SpringSource Case Studies page – it turns out that they had a bunch of Groovy and Grails related case studies that I hadn’t seen before.


There were four new plugins released:

  • ajaxflow version 0.1.8. Enables ajaxified webflows
  • error-pages-fix version 0.2. Workaround for GRAILS-6992
    until Grails 1.4 is released
  • full-calendar version 0.1.4. Adds support for the FullCalendar jQuery plugin
  • twitter-checker version 0.1. Monitors Twitter for events including new followers and unfollows in your account, new RTs of you made by other users, and new mentions to you made by other users

There were also several updated plugins:

  • activiti version 5.0. Integrates the Activiti BPM Suite and workflow system
  • autobase version 0.10.0. This abandoned plugin has been picked up by new developers
  • cassandra version Provides access to Cassandra (not a GORM layer).
  • dojo version Adds the Dojo javascript toolkit.
  • fsm version 0.6.4. Adds Finite State Machine behaviors to domain classes.
  • gorm-mongodb version 0.5.4. Adds a GORM wrapper for MongoDB.
  • jasper version Enables use of JasperReports.
  • localizations version 1.4.1. Stores I18N messages in the database.
  • remoting version 1.2. Exposes Grails services over RMI, Hessian, Burlap, and Spring’s HttpInvoker protocols
  • spreedly version 0.1.2. Provides access to the Spreedly online payment service API
  • ulc version 0.3.1. Provides access to the Canoo UltraLightClient (ULC) RIA kit

In addition, I wanted to draw particular attention to one plugin update, the 1.0 release of the console plugin. This is one of my favorite plugins and I released an updated version yesterday and wrote up some notes here.


Saturday, October 24th, 2009

I got back from Spring One/2GX in New Orleans a couple of days ago and wanted to write up some thoughts about what a great time it was. This was my first SpringOne – my first attempt at getting sent by my employer didn’t go so well and I didn’t go to the Groovy/Grails Experience in Reston, VA in 2008. But earlier this year I noticed Guillaume Laforge’s tweet announcing the presentation request page so I submitted 5 Grails proposals, and luckily 4 were selected.

I got into New Orleans around 1:30 on Monday and took a cab to the hotel. When I checked in the clerk smiled and told me I’d been upgraded to a very nice room. She wasn’t kidding, it was huge. As a geek all I need is a bed and a shower (and of course wifi and power for the laptop) but it was cool that the organizers got the speakers such nice rooms.

I went to registration to get my speaker badge and schedule and met Dave Klein, the first of many famous GR8 folks that I met this week. After that I went out wandering and ended up on Bourbon St. Even at 3pm on a Monday it was pretty wild, lots of people and great music. Later on was dinner and then Rod Johnson’s keynote. Of course the highlight for us Grails folks was Graeme’s demo of STS 2.2 with Grails support. After the keynote a bunch of us went to Bourbon St. and had some beers.

My first session of the conference was my Clustering a Grails Application for Scalability and Availability talk. They’d assigned talks to the various rooms based on expected attendance but based on responses from the attendee questionnaire they moved some talks and mine got moved to a larger room, so there was a little confusion there. I’d given an earlier version of this talk at the Boston Grails meetup so it was a good one to do first. It went pretty well and the audience asked lots of great questions. Unfortunately although I discussed two Quartz bugs that need to be fixed, I only fixed one, so the demo crashed with an error that wasn’t very obvious, so I wasn’t able to get that fixed. Of course 5 minutes after the talk I realized what I’d forgotten.

Next up was Hamlet D’Arcy’s Groovy Compiler Metaprogramming and AST Transformations. AST transforms are a powerful addition to Groovy but it’s a complex topic and Hamlet did a great job explaining the concepts. The AST viewer that he wrote is pretty slick. I’ve got a couple of potential uses for ASTs that I’ll be trying out in the next few weeks.

After lunch was my UI Performance – Maximizing Page Load Efficiency talk. This one surprised me. I’m not a UI guy, but I am a performance nut and I’m psyched about what the UI Performance plugin provides to Grails applications. But I was concerned about running under for this talk since this isn’t really an area of expertise for me. However we had a great interactive discussion with lots of great audience questions and this talk was ironically probably the best of the four that I did.

After that was Andy Clement’s Eclipse Groovy Tooling. I’m a hardcore Eclipse user and had been using the v1 Eclipse Groovy plugin. The work that Andy Clement and Andrew Eisenberg have done with the v2 plugin has been fantastic. I’m subscribed to the
eclipse-plugin-user and eclipse-plugin-dev mailing lists so I’m aware of a lot of what’s happened along the way but it was great to hear the stories and challenges from the source.

The last session of the day was Ken Sipe’s Grails and the JVM Memory Management. I’m comfortable with garbage collection and the various heap generations so I didn’t get much out of the first part of Ken’s talk but the demos of VisualVM and BTrace were great. It’s always good to add new tools to the toolkit and these look great.

I got Thai takeout for dinner and skipped Adrian Colyer’s technical keynote to do prep for the next day’s talk but went to the Grails BOF. It was a lively discussion with Graeme and Jeff – you can listen to a recording that Colin Harrington tweeted here.

The first talk Wednesday was Andres Almiray’s Flying with Griffon. I’m a big fan of Griffon, having done a bunch of Swing development. Pretty much everything I do currently is web-based but I’m looking for an excuse to write a desktop app in Griffon and after seeing Andres’ talk I’m even more psyched. The highlight of the talk was finding out that the slick presentation that he’d switched to from his PowerPoint slides was actually a Griffon app: Griffon Talk. btw – I highly recommend Griffon in Action – it’s available in Manning’s early access program and is already packed with great information.

Next was Matt Taylor’s GrailsUI Primer. Being a bad UI developer I need good tools for UI work and GrailsUI is very good. Matt also suggested that it’d be good to integrate GrailsUI with the UI Performance plugin, so that should be interesting.

After lunch was my Advanced GORM – Performance, Customization and Monitoring talk. When I did an earlier version of this talk at the Boston Grails meetup it ran long and I didn’t get to the demo of the graphics and monitoring part, so I rushed this one a bit. But overall the audience seemed to find the content interesting. I even had some people offer to help making the monitoring stuff into a plugin – please email me if you were one of them.

Next was my one Spring talk, Chris Richardson’s Running Java and Grails applications on the Amazon Elastic Compute Cloud. I’ll be working on a project that will deploy to EC2 so this is useful info, but to be honest I was more than a little distracted since they had just announced that STS 2.2 was released so I spent a lot of the talk trying that out.

The final talk of the day was Paul King’s Groovy and Concurrency talk. This was an interesting discussion of the various options for multithreading in Groovy, from Ant’s parallel task to various wrappers of the java.util.concurrent classes like Jetlang and GPars, and the new Fork/Join stuff that’ll be in Java 7.

That night I had dinner with Calen and Chelle from Orange and Bronze. I’ll be working on an outsourcing project with them and they had a booth at the conference, so it was a good opportunity to talk with them in person. The restaurant was at the other end of the French Quarter so we had plenty of time to talk – if the rest of the company is like Calen and Chelle we’ll be in good hands.

I did some prep work for the next day’s Demystifying Spring Security in Grails talk and got to bed reasonably early, but for some reason didn’t set an alarm. Luckily a friend who noticed that I wasn’t available on IM called me at 8am so I at least had 1/2 hour to take a shower and get ready. I didn’t have any caffeine or breakfast and was pretty annoyed at myself for nearly screwing up in a major way, but like the rest of the talks I got plenty of great questions and participation from the audience so except for yet another partially failed demo things went well.

I had another celebrity sighting on the way to the talk: Luke Taylor, who’s currently doing most of the work on Spring Security now that Ben Alex is working on Roo. We talked briefly about the breaking changes in Spring Security 3 that are prompting me to write a new plugin (this will be a great opportunity to start from scratch and also modularize the plugin btw) and he offered to answer questions, so I’ll definitely be taking him up on that offer. Later I ran into Luke and Ben in the hotel coffee shop when I was finally able to get caught up on caffeine and I talked to Ben about Roo – he’s clearly excited about the enthusiasm that people have shown for Roo so far. I doubt I’ll do much with Roo since I’ve spent so much time working with Grails, but I can see how Java developers who like the idea of Convention over Configuration but aren’t ready to make the leap to the dynamic language-based Grails would find Roo attractive.

I was going to go to Ramnivas Laddad’s AOP talk next, but I needed to check out and hadn’t had a chance to pack since I’d overslept, so I did that and spent some time catching up on email. I got a takeout falafel wrap from a funky little Middle Eastern place near the hotel and spent some time working on parallelizing Grails integration tests (inspired by a thread on the Grails user mailing list and Paul King’s talk). It’s mostly finished; once I get it working I’ll post the code and a writeup – it should help speed up test time on multicore machines.

My last talk of the conference was Scott Vlaminck’s AOP in Grails. I had heard about Scott’s Circuit Breaker Plugin but didn’t read enough about it to see how it’d be useful. So I was glad I went to the talk – this plugin is a great idea. We have a Log4j SMTP appender configured on a project and on two occasions recently have generated over 2000 error emails in under an hour, so a circuit breaker would have come in very handy there. Most of the time in Grails we can just use MOP for before/around/after advice, but “real” AOP is necessary when Java is calling Java since there isn’t a hook for MOP.

So it was a fantastic 3 1/2 days. It was cool to meet so many people that I had previously only known online, both the big names in the Groovy/Grails/Griffon communities but also developers, plugin authors, and other users and fans of the GR8 stack.

I’ll be posting the presentations and sample apps for the talks that I did when I get a chance so people can try them out and hopefully take advantage of some of the code.

I’m definitely psyched for next year, and I’m also looking forward to the next GR8 event, the Groovy & Grails Exchange in London in December. After that I’ll be headed to the Philippines in January to work with Orange and Bronze and speak at a Spring and Grails conference that they’re sponsoring, so it’ll be an interesting few months.

An internal error occurred while showing an internal error

Friday, January 02nd, 2009

I get this a lot using the Groovy/Grails Eclipse plugin at work:

An internal error occurred while showing an internal error

This reminds me of that line from Brazil – “My complications had complications.”

Yes I’ve tried Netbeans and IntelliJ – they’re nice but I don’t want to re-learn an IDE, I’ve spent a lot of time with Eclipse and other than the Groovy plugin, it does what I need and very well. And yes I’ve played with memory settings in eclipse.ini.

I have several Grails apps in my workspace, so I try to keep open only the ones that I’m actively using to avoid memory issues. But eventually memory gets screwy, and I get to restart Eclipse again. Yay!

I’m definitely looking forward to SpringSource allocating resources to improving the plugin now that they’ve aquired G2One – should help tremendously.


Tuesday, January 29th, 2008

Well this is a first – I’ve had to roll back a JDK update to the previous version due to crashing. Luckily I always keep the previous version in case I need to roll back but never have; I install the binary JDK into (in this case) /usr/local/jdk1.6.0_04 and symlink this to /usr/local/jdk so I don’t need to change my path. So it was a simple matter to symlink to /usr/local/jdk1.6.0_03 and the problem went away.

The problem was that Eclipse started crashing recently and I blamed Eclipse and/or a bad plugin or combination of plugins instead of the JDK upgrade. So I reinstalled Eclipse, cleared out the workspace/.metadata caches, re-installed plugins a few at a time, re-imported projects and nothing – still crashed regularly. Big ugly JDK crashes with hs_err_pid.log files full of stuff like

# An unexpected error has been detected by Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0x00002b4516f0722a, pid=28013, tid=1085491536
# Java VM: Java HotSpot(TM) 64-Bit Server VM (10.0-b19 mixed mode linux-amd64)
# Problematic frame:
# V  []
# If you would like to submit a bug report, please visit:
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

I did some Googling but this is a new problem and only seems to affect 64-bit JDKs, so there’s not much discussion going on. One guy mentioned that adding “-client” to eclipse.ini helped, but not for me. Turns out that there is no client JVM for 64-bin Linux (or Windows) JDKs (see the discussion here).

So this morning I switched back to u3 and everything seems to work fine now.

I’m also running Kubuntu on my shiny new workstation at my shiny new job and had the same problem, but didn’t have the previous install to revert to. Luckily though Sun keeps archived previous versions and I was able to download u3 here.

An Updated JUnit AllTests Suite

Thursday, December 13th, 2007

I upgraded to JUnit 4.4 and my AllTests utility class that runs all tests in a project broke because I’d been using internal APIs (org.junit.internal) that were refactored between 4.1 and 4.4. It took some digging into their source code but I’ve got it fixed.

Of course Ant has great support for JUnit from the command line – I use this in Eclipse to allow quick “Run As JUnit Test” support, set breakpoints, take advantage of the IDE’s UI that monitors progress, etc.

This is an extension of their @RunWith/@SuiteClasses annotation facility that auto-discovers all test classes rather than specifying a list of class names. A hard-coded list is a pain to maintain and for a large project would be enormous (assuming decent test coverage that is …).

The old code had a static inner class that extended org.junit.internal.runners.TestClassRunner and passed in the results of a directory scan of *Test.class files that aren’t abstract, rather than using the value of the @SuiteClasses annotation. The current implementation is very similar – it extends org.junit.runners.Suite instead.

One interesting feature of this approach is that you have a hook into the start of the test suite, and can also attach event listeners to be notified of start/stop events, failures, etc. This is important because test classes no longer extend a JUnit class – annotations are used instead. So for example it’s no longer possible for to access the name of the currently running test method in a generic fashion.

You could add code to each method but this is brittle and clutters the code. Instead of overriding setUp we use @Before annotatons on one or more methods, but these aren’t the test methods and are invoked using reflection so there’s no hook into the test method that’s about to be run. So in the code below I add an event listener to log the start and end of each test method. This was useful recently when I was chasing down a Collection leak that caused tests to hang once the connection pool was maxed out.

To use this, just right-click it in the class tree in Eclipse and click “Run As JUnit Test”.

import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import org.apache.log4j.Logger;
import org.junit.internal.runners.InitializationError;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.Suite;

 * Discovers all JUnit tests and runs them in a suite.
public final class AllTests {

  private static final File CLASSES_DIR = findClassesDir();

  private AllTests() {
    // static only

   * Finds and runs tests.
  public static class AllTestsRunner extends Suite {

    private final Logger _log = Logger.getLogger(getClass());

     * Constructor.
     * @param clazz  the suite class - <code>AllTests</code>
     * @throws InitializationError  if there's a problem
    public AllTestsRunner(final Class<?> clazz) throws InitializationError {
      super(clazz, findClasses());

     * {@inheritDoc}
     * @see org.junit.runners.Suite#run(org.junit.runner.notification.RunNotifier)
    public void run(final RunNotifier notifier) {

      notifier.addListener(new RunListener() {
        public void testStarted(final Description description) {
          if (_log.isTraceEnabled()) {
            _log.trace("Before test " + description.getDisplayName());

        public void testFinished(final Description description) {
          if (_log.isTraceEnabled()) {
            _log.trace("After test " + description.getDisplayName());

    private static Class<?>[] findClasses() {
      List<File> classFiles = new ArrayList<File>();
      findClasses(classFiles, CLASSES_DIR);
      List<Class<?>> classes = convertToClasses(classFiles, CLASSES_DIR);
      return classes.toArray(new Class[classes.size()]);

    private static void initializeBeforeTests() {
      // do one-time initialization here

    private static List<Class<?>> convertToClasses(
        final List<File> classFiles, final File classesDir) {

      List<Class<?>> classes = new ArrayList<Class<?>>();
      for (File file : classFiles) {
        if (!file.getName().endsWith("Test.class")) {
        String name = file.getPath().substring(classesDir.getPath().length() + 1)
          .replace('/', '.')
          .replace('\\', '.');
        name = name.substring(0, name.length() - 6);
        Class<?> c;
        try {
          c = Class.forName(name);
        catch (ClassNotFoundException e) {
          throw new AssertionError(e);
        if (!Modifier.isAbstract(c.getModifiers())) {

      // sort so we have the same order as Ant
      Collections.sort(classes, new Comparator<Class<?>>() {
        public int compare(final Class<?> c1, final Class<?> c2) {
          return c1.getName().compareTo(c2.getName());

      return classes;

    private static void findClasses(final List<File> classFiles, final File dir) {
      for (File file : dir.listFiles()) {
        if (file.isDirectory()) {
          findClasses(classFiles, file);
        else if (file.getName().toLowerCase().endsWith(".class")) {

  private static File findClassesDir() {
    try {
      String path = AllTests.class.getProtectionDomain()
      return new File(URLDecoder.decode(path, "UTF-8"));
    catch (UnsupportedEncodingException impossible) {
      // using default encoding, has to exist
      throw new AssertionError(impossible);

Some New Features in Eclipse 3.2

Thursday, August 10th, 2006

In no particular order, some features that I’ve noticed but don’t remember seeing in the documentation:

  • When you open a closed project it asks if you also want to reopen referenced projects
  • Package Explorer filtering has an option to filter project libraries
  • There’s a Heap monitor widget with a GC button – Window|Preferences|General|Show Heap Status (there are plugins for this but it’s nice to have it as part of the IDE)
  • If you type a semicolon inside a string it inserts it in the string, not at end of line (assuming you have semicolon auto-insert on)
  • Ctrl-Shift-C (comments out the selected text) now works in Linux. That’s been annoying, having switched from Windows (and still using Windows at work). I use a lot of keyboard shortcuts and losing one is frustrating.
  • Typing ${ in the Ant editor autocompletes build properties and it even shows the currently resolved value for the property.
  • An autogenerated default implementation of a method override now inserts a “non-Javadoc” @see comment in addition to the @Override annotation, e.g.
/* (non-Javadoc)
 * @see java.lang.Object#toString()
public String toString() {
  // TODO Auto-generated method stub
  return super.toString();

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.