开发者

Grails MissingPropertyException

I've been getting a str开发者_C百科ange error that has had me hung up all morning. I have a Grails application with a Person class that looks like this:

class Person {
        String id
    Date   lastUpdated
    String note
    String lastName
    String firstName
    String middleName
    String facility
    ...
}

In my controller, I have a closure to obtain the model:

def personDetail = {
    Person person = new Person()
    ...
    List<Person> personSearchList = session.getAttribute("searchResults")
    Person selectedSearchPerson = selectedSearchPersonList.find { it.id == selectedID }
    person.firstName = selectedSearchPerson.firstName
    person.lastName = selectedSearchPerson.lastName
    person.middleName = selectedSearchPerson.middleName
    person.facility = selectedSearchPerson.facility
    ...
    return [person:person]
}

Now, this code was working fine yesterday. This morning however, without making any modifications (I have even tried reverting to older svn submissions) I am getting the following error when I click the g:link to display the detailController gsp:

groovy.lang.MissingPropertyException: No such property: facility for class: org.icf.Person
at org.bjc.icf.DetailController$_closure3.doCall(DetailController.groovy:33)
at org.bjc.icf.DetailController$_closure3.doCall(DetailController.groovy)
at java.lang.Thread.run(Thread.java:619)

I've tried looking up a solution to what might be causing this error online but I can't seem to find anything. Does anyone have any idea why I might all of a sudden be getting MissingPropertyExceptions on previously working code (and yes, I have checked to make sure the property is still in the class).


Try running grails clean - sometimes incremental compilation fails so forcing a full compile will often make weird issues like this go away.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜