Tuesday, December 22, 2009

Grails "pluginManager" error

STS has the cool feature where it dynamically recompiles your Grails application when it senses that you've made code changes. This can have an unexpected side effect. If you get an obscure message like the following:

Error creating bean with name 'pluginManager' defined in ServletContext...

Basically it seems related to a mismatch between the domain objects and the database schema. This is different from GORM and Object-Relational Impedance Mismatch... it is simply an unstable condition that might occur with the right combination of changes.

Unfortunately, I can only suggest saving and testing often, and if you see this message, try commenting out the "static hasMany" command in your domain object until it goes away.

Investigating and installing Grails

Based on a recommendation (and some newly acquired knowledge), I'm in the process of investigating Grails and perhaps GWT. This post, and likely the next few posts, will chronicle the installation, setup, and initial experience.

To install Grails, go to the Grails Home Page and download the latest version. Go to the Documentation page and follow the installation instructions. I am using a Debian-based Linux so I extracted Grails into /usr/share/grails and added GRAILS_HOME to my .bashrc. Testing Grails worked without any issue. My current version is 1.1.2.

It then occurred to me that I would really like to implement Grails from within Eclipse and to explore my options for Eclipse add-ons or integration. I chose to use SpringSource Tool Suite (STS).

For the most part, you'll follow the instructions on this page except STS-go here instead to download STS. Click on the appropriate OS link to the right of the Downloads section then follow the instructions at the bottom of that same page. Note: You may want to invoke the installer using "sudo" if you plan to install in a location like /usr/share. However, when asked to launch STS at the end, say "no" and launch STS explicitly. The executable is /usr/share/springsource/sts-2.3.0.RELEASE/STS

Once you have STS installed, go back to this page and follow the instructions to install the Groovy and Grails plug-ins. Note: If you installed STS as "sudo" in the previous step, you may want to invoke STS using "sudo" to install the plug-ins. Before I did this, it hung at about 67% for no apparent reason. For example, execute "sudo /usr/share/springsource/sts-2.3.0.RELEASE/STS" from a shell and use that session to install the plug-ins.