Grails getSomething(int i)方法不能编译 [英] Grails getSomething(int i) method doesn't compile

查看:113
本文介绍了Grails getSomething(int i)方法不能编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  class Person {$ b $}有人可以告诉我为什么这个Grails领域类不会编译(在运行时)吗? b字符串名称

字符串getSomething(int i){
}
}

使用 grails run-app 运行时出现此错误:

  2008-12-27 15:26:33.955 :: WARN:上下文启动失败org.mortbay.jetty.webapp.WebAppContext@187e184 {/ asrs2,C:\Steve\asrs2/web -app} 
org.springframework.beans.factory.BeanCreationException:在ServletContext资源[/WEB-INF/applicationContext.xml]中定义名称为'pluginManager'的bean时创建错误:调用init方法失败;嵌套的异常是java.lang.NullPointerException $ b $ java.util.AccessController.doPrivileged(Native Method)
RunApp_groovy $ _run_closure2_closure7.doCall(RunApp_groovy:67)
RunApp_groovy $ _run_closure2_closure7.doCall( (RunApp_groovy)
at Init_groovy $ _run_closure6.doCall(Init_groovy:131)
在RunApp_groovy $ _run_closure2.doCall(RunApp_groovy:66)
在RunApp_groovy $ _run_closure2.doCall(RunApp_groovy)
at RunApp_groovy $ _run_closure1.doCall(RunApp_groovy:57)RunApp_groovy
$ _run_closure1.doCall(RunApp_groovy)
at gant.Gant.dispatch(Gant.groovy:271)
at gant.Gant.this $ 2 $ dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:436)
at gant.Gant.processArgs (Gant.groovy:372)
导致:java.lang.NullPointerException $ b $ java.lang.Class.isAssignableFrom(Native Method)
... 13 more

如果我更改方法 getSomething doSomething 然后它工作。

后续:这是一个 Grails bug ,它将在1.2中修复。

解决方案

我断定这是Grails的一个错误。我已经创建了 GRAILS-3760 ,它已在Grails 1.1.2中修复。


Can someone tell me why this Grails domain class will not compile (at runtime)?

class Person {
    String name

    String getSomething(int i) {
    }
}

I get this error when I run with grails run-app:

2008-12-27 15:26:33.955::WARN:  Failed startup of context org.mortbay.jetty.webapp.WebAppContext@187e184{/asrs2,C:\Steve\asrs2/web-app}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
        at java.security.AccessController.doPrivileged(Native Method)
        at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy:67)
        at RunApp_groovy$_run_closure2_closure7.doCall(RunApp_groovy)
        at Init_groovy$_run_closure6.doCall(Init_groovy:131)
        at RunApp_groovy$_run_closure2.doCall(RunApp_groovy:66)
        at RunApp_groovy$_run_closure2.doCall(RunApp_groovy)
        at RunApp_groovy$_run_closure1.doCall(RunApp_groovy:57)
        at RunApp_groovy$_run_closure1.doCall(RunApp_groovy)
        at gant.Gant.dispatch(Gant.groovy:271)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.processTargets(Gant.groovy:436)
        at gant.Gant.processArgs(Gant.groovy:372)
Caused by: java.lang.NullPointerException
        at java.lang.Class.isAssignableFrom(Native Method)
        ... 13 more

If I change the method getSomething to doSomething then it works. Is getSomething(int i) somehow being treated as a bean method?

Follow up: This is a Grails bug which will be fixed in 1.2.

解决方案

I've concluded that this is a bug with Grails. I've created GRAILS-3760 which has been fixed in Grails 1.1.2.

这篇关于Grails getSomething(int i)方法不能编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆