Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GRAILS - Don't use this packages!

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
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.

Copy link

@mr-simonski mr-simonski commented Jan 7, 2015

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?


This comment has been minimized.

Copy link

@lucianosantanabr lucianosantanabr commented Dec 24, 2018

@mr-simonski, Hi, did you solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment