从Grails开始我已经安装了Grails版本2.4.0并在GNU / Linux上使用JDK 1.7.0_55我执行下面的操作序列,但不断获得NullPointerException。有人能指出我错过或做错的事吗?
grails create-app firstgrails
cd firstgrails
grails
grails> run-app
我转到localhost:8080 / firstgrails并查看生成的页面。
接下来我做
grails> create-domain-class tag
然后转到firstgrails / grails-app / domain / firstgrails文件夹并编辑Tag.groovy,使其包含:
// Tag.groovy
package firstgrails
class Tag {
String name
String description
}
下一步
grails> create-controller tag
并将firstgrails / grailsapp / controllers / firstgrails / TagController.groovy编辑成
// TagController.groovy
package firstgrails
class TagController {
static scaffold = Tag
}
我在浏览器和firstgrails中重新加载.TagController被添加到可用列表中 欢迎辞下的控制器。选择它,我创建一个带有名称和描述的标签,标签按预期显示在标签列表中。但是现在每当我尝试添加第二个标签时,我都会收到500错误:内部服务器错误
URI: /firstgrails/tag/create
Class: java.lang.NullPointerException
Message: null
控制台中的跟踪是:
Error 2014-06-03 18:28:31,714 [http-bio-8080-exec-2] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /firstgrails/tag/create
Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <g:render>: null
Line | Method
->> 527 | doFilter in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 73 | doCall . in tag_create$_run_closure2_closure24
| 78 | doCall in tag_create$_run_closure2
| 81 | run . . . in tag_create
| 189 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
| Error 2014-06-03 18:30:33,050 [http-bio-8080-exec-9] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /firstgrails/tag/create
Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <g:render>: null
Line | Method
->> 527 | doFilter in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 73 | doCall . in tag_create$_run_closure2_closure24
| 78 | doCall in tag_create$_run_closure2
| 81 | run . . . in tag_create
| 189 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
| Error 2014-06-03 18:32:21,796 [http-bio-8080-exec-5] ERROR errors.GrailsExceptionResolver - NullPointerException occurred when processing request: [GET] /firstgrails/tag/create
Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:form>: Error executing tag <g:render>: null
Line | Method
->> 527 | doFilter in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:form>: Error executing tag <g:render>: null
->> 35 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by GrailsTagException: Error executing tag <g:render>: null
->> 30 | doCall in /tag/create
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Caused by NullPointerException: null
->> 333 | hash in java.util.concurrent.ConcurrentHashMap
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 988 | get in ''
| 141 | getValue in grails.util.CacheEntry
| 81 | getValue in ''
| 73 | doCall . in tag_create$_run_closure2_closure24
| 78 | doCall in tag_create$_run_closure2
| 81 | run . . . in tag_create
| 189 | doFilter in grails.plugin.cache.web.filter.PageFragmentCachingFilter
| 63 | doFilter in grails.plugin.cache.web.filter.AbstractFilter
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
答案 0 :(得分:4)
我试过这个并且能够重现它。如果我们生成视图然后它被解析但没有视图它会给出错误。 grails
jira
中存在问题,请参阅this issue他们为其提供的补丁。
希望这有帮助。