Thursday, November 12, 2015

Grails $getStaticMetaClass() hot class reloading error fix

I came across an error while testing some Grails changes AFTER upgrading my local Java version to Java 8. Basically any class that was a subclass that I tried to save while the app was up and running would throw a compiler error. One of the beauties of developing with Grails is that you don't have to redeploy every time you want to make a change, you can just save it while it's running and the change will be picked up instantaneously.

 The problem is that the spring-loaded 1.2.3 JAR doesn't play nice with Java 8 for some reason. The way hack to fix this is to download the spring-loaded 1.2.4 JAR (here), and then insert it into your Grails installation libs directory and then removing the 1.2.3 JAR(s).

Then perform a clean-all and then start the app.

Cheers.