This is not Grails fault, but Spring-Loaded's.
They make the assumption that you won't put any of your own code under a package called in certain ways, and caches classes under that packages, which are meant to be used only by the framework. The most significant ones for us are grails.*
and groovy.*
. As a result, if you do use that packages, you will get something like this when trying to reload those classes:
2014-09-26 04:21:20,945 [FileSystemWatcher: files=#100 cl=java.net.URLClassLoader@
19d86dfc] ERROR plugins.AbstractGrailsPluginManager - Plugin [services:2.4.2] could not reload changes to file [/<path to ggts workspace>/ggts-workspace/grails-slow3/grails-app/services/slow/SomeClassService.groovy]: Cannot get property 'cacheOperationSource' on null object
Message: Cannot get property 'cacheOperationSource' on null object
Line | Method
->> 184 | doCall in CacheGrailsPlugin$_closure4
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
^ 745 | run in java.lang.Thread
Here is the source code that explains it:
The solution:
Always namespace your packages with your apps' or company's name. Avoid getting your classes confused with the framework classes.
This comment has been minimized.
Thanks for this hint! I'm experiencing this error message with Grails 2.4.4 ànd Intellij IDEA 14.0.2 even without having any strings containing grails.* or groovy.* in my package names. But the controllers and services I build import packages with those names in it like
import grails.converters.JSON
Is this causing the error? What to do about that?