2011-12-11 2 views
0

SQL 서버 2000을 사용하는 간단한 Grails 1.3.7 애플리케이션. 연결 OK. OK를 눌러 새 테이블을 만듭니다. 그러나 기존 테이블에 액세스하려고하면 아래 오류를 참조하십시오. 제약 조건 : 기존 데이터를 변경할 수 없습니다. 질문 :이 오류 라인은 [35] 파일입니까? null 객체를 허용 할 수있는 방법이 있습니까 (예 : 객체가 null 일 때 속성 'id'를 가져 오지 않을 경우)?레거시 데이터베이스 SQL 서버로 작업하는 Grails

Error 500: 
Servlet: default 
URI: /root0001/person/list 
Exception Message: Cannot get property 'id' on null object 
Caused by: Error evaluating expression [personInstance.id] on line [35]: Cannot get property 'id' on null object 
Class: /person/list 
At Line: [35] 
Code Snippet: 
Stack Trace 

org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [personInstance.id] on line [35]: Cannot get property 'id' on null object 

    at person_list$_run_closure2_closure27.doCall(person_list:67) 

    at person_list$_run_closure2.doCall(person_list:60) 

    at person_list$_run_closure2.doCall(person_list) 

    at person_list.run(person_list:76) 

    at java.lang.Thread.run(Thread.java:722) 

Caused by: java.lang.NullPointerException: Cannot get property 'id' on null object 

    at person_list$_run_closure2_closure27_closure34.doCall(person_list:67) 

    ... 5 more 
+0

어디에서 'personInstance'를 검색합니까 ?? – gotomanners

답변

1

이 경우는 list.gsp의 personInstance ID를 렌더링하려고 시도하는 섹션에서 발생할 수 있습니다. Groovy safe dereference operator을 사용하여이를 해킹 할 수 있지만 데이터베이스가 의 null 객체를 반환하는 이유를 조사 할 수 있습니다.

관련 문제