Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grails 2.4.3 fails to reload controller or service

I have upgraded a Grails 2.3.8 project to 2.4.3. In 2.3.8 we had problems with forked execution, so I have disabled it. Now, when I enable it, and try to reload a changed service or controller class, I get error like these:

2014-09-25 19:50:37,043 [Thread-11] ERROR plugins.AbstractGrailsPluginManager  - 
Plugin [controllers:2.4.3] could not reload changes to file [C:\projects2\...\grails-app\controllers\com\...\AdminController.groovy]: 
Cannot get property 'cacheOperationSource' on null object
java.lang.NullPointerException: Cannot get property 'cacheOperationSource' on null object

2014-09-25 19:42:26,251 [Thread-11] ERROR plugins.AbstractGrailsPluginManager  - 
Plugin [controllers:2.4.3] could not reload changes to file [C:\projects2\...\grails-app\controllers\...\AdminController.groovy]:
Cannot get property 'instanceControllerTagLibraryApi' on null object
java.lang.NullPointerException: Cannot get property 'instanceControllerTagLibraryApi' on null object

I have in BuildConfig

forkConfig = [maxMemory: 2048, minMemory: 2048, debug: false, minPerm:256, maxPerm: 512]
grails.project.fork = [
    test: forkConfig,
    run: forkConfig, 
    war: forkConfig, 
    console: forkConfig
] 

I run Grails so:

set JAVA_OPTS=-Dgrails.full.stacktrace=true -Ddisable.auto.recompile=true -Xmx2048M -Xms2048M -XX:PermSize=512m -XX:MaxPermSize=1024m -Djava.net.preferIPv4Stack=true
grailsw --stacktrace --verbose -Dserver.port=5678 run-app %1 %2 %3 %4

The error comes no matter if I have -reloading in run-app or not. Am I understanding something wrong? Is it so, that I can't have reloading AND forked execution at the same time?

If I set all forked entries to false, it works like before.

Thank you in advance. Best regards: Balázs

like image 365
Bámer Balázs Avatar asked Sep 25 '14 18:09

Bámer Balázs


Video Answer


1 Answers

A similar problem was posted in the grails dev discus mailing list a few hourse ago. From the sample app that I was able to view, it seems the error happened when the package name of the class being edited had "grails" in it. https://groups.google.com/forum/#!topic/grails-dev-discuss/u5gvuwWXoTk

You should check for that in your naming convention and change it to something more specific to your app....

like image 157
daptordarattler Avatar answered Oct 13 '22 21:10

daptordarattler