且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Grails 2.4.3无法重新加载控制器或服务

更新时间:2023-02-12 11:02:06

类似的问题几个小时前发布在grails dev cookies邮件列表中。从我能够查看的示例应用程序中看来,当正在编辑的类的包名称中包含grails时,发生错误。
https://groups.google.com/forum /#!topic / grails-dev-discuss / u5gvuwWXoTk



您应该检查命名约定中的内容,并将其更改为更具体的应用程序....


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

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