Grails 2.4.3 fails to reload controller or service
Asked Answered
L

1

8

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

Latent answered 25/9, 2014 at 18:12 Comment(0)
A
2

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

Axle answered 26/9, 2014 at 5:6 Comment(8)
Thank you for the answer. Well, we have grails in some package names like "com.company.grails.util" but not where the controller fails to load. I try it anyway...Whinny
Any results with the package names? And from the mailing lists, its both 'grails' and 'groovy' that you should be checking in the package nameAxle
I tried to refactor it in Eclipse, but it failed. It is too complicated. I disabled forked execution, and everything is good. However, I don't know if this is a solution for me, as the class that failed to reload has neither grails, nor groovy in package names. Sorry, I can't try it.Whinny
I'm also getting this error inspite of reloading using grails -reloading run-appPaleoecology
It appears that having 'controller' in the package name triggers this as well.Alkylation
we have the same problem - any edit to a controller gives this error. We dont have anything like this in our package names, they are just com.ourdomain.ourapp.USA for exampleHudson
Anybody find a resolution to this problem? Just started a new 2.5.5 Grails application - no 'grails' (or other grails artefact names for that matter) in package names, and reloading fails consequently....Sherleysherline
No - but it magically disappered and I haven't seen it since. Also it was isolated to one machine - others running the same codebase had no problmes. MB delete .grails folder and target/build folder and try again?Sherleysherline

© 2022 - 2024 — McMap. All rights reserved.