Spring MVC/Hibernate - NullValueInNestedPathException, Invalid property, value of nested property is null? -
we enhancing already existing web application in spring mvc (and i'm learning framework). tried adding property object being pushed database (i added corresponding column, too) keep getting nullvalueinnestedpathexception
error.
i tried google , suggestions follows:
1) explicitly declare constructor new property (tried, didn't solve it)
2) make sure instantiate new object (tried, didn't solve it)
3) double check getters/setters of property (they ok, wasn't error)
4) create serialversionuid (nah!)
5) use debug feature (i did, , found out property is null)
please help! t.t here codes:
vo of new property:
public class shiftassignmentlookupvo implements serializable{ ... public shiftassignmentlookupvo(){} public string getshiftassignmentstringvalue(){ return shiftassignmentstringvalue; } public void setshiftassignmentstringvalue(string shiftassignmentstringvalue){ this.shiftassignmentstringvalue = shiftassignmentstringvalue; } ... }
vo of object contains property:
public class employeecalendarvo implements serializable { ... //the new property: private shiftassignmentlookupvo shiftassignmentvo = new shiftassignmentlookupvo(); public void setshiftassignmentvo(shiftassignmentlookupvo shiftassignmentvo){ this.shiftassignmentvo = shiftassignmentvo; } public shiftassignmentlookupvo getshiftassignmentvo(){ return shiftassignmentvo; } ... }
and here hibernate mapping:
<class name = "employeecalendarvo" table = "emp_wrk_cdr"> ... <many-to-one name = "shiftassignmentvo" lazy = "false"> <column name = "id_assignment" /> </many-to-one> ... </class>
the jsp try access property:
<spring:bind path = "employeecalendar.empcallist[${ecl.index}].shiftassignmentvo.shiftassignmentid"> ... </spring:bind>
and last (whew!) stack trace:
aug 8, 2013 10:36:18 org.apache.catalina.core.standardwrappervalve invoke severe: servlet.service() servlet dtr threw exception org.springframework.beans.nullvalueinnestedpathexception: invalid property 'empcallist[0].shiftassignmentvo' of bean class [com.safeway.dtr.employee.vo.empcalmanager]: value of nested property 'empcallist[0].shiftassignmentvo' null @ org.springframework.beans.beanwrapperimpl.getnestedbeanwrapper(beanwrapperimpl.java:443) @ org.springframework.beans.beanwrapperimpl.getbeanwrapperforpropertypath(beanwrapperimpl.java:418) @ org.springframework.beans.beanwrapperimpl.getbeanwrapperforpropertypath(beanwrapperimpl.java:419) @ org.springframework.beans.beanwrapperimpl.getpropertyvalue(beanwrapperimpl.java:524) @ org.springframework.validation.abstractpropertybindingresult.getactualfieldvalue(abstractpropertybindingresult.java:78) @ org.springframework.validation.abstractbindingresult.getfieldvalue(abstractbindingresult.java:337) @ org.springframework.web.servlet.support.bindstatus.<init>(bindstatus.java:119) @ org.springframework.web.servlet.tags.bindtag.dostarttaginternal(bindtag.java:116) @ org.springframework.web.servlet.tags.requestcontextawaretag.dostarttag(requestcontextawaretag.java:77) @ org.apache.jsp.web_002dinf.jsp.employee.employeecalendar_jsp._jspservice(employeecalendar_jsp.java:1184) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:388) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:313) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:260) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.applicationdispatcher.invoke(applicationdispatcher.java:646) @ org.apache.catalina.core.applicationdispatcher.doinclude(applicationdispatcher.java:551) @ org.apache.catalina.core.applicationdispatcher.include(applicationdispatcher.java:488) @ org.apache.jasper.runtime.jspruntimelibrary.include(jspruntimelibrary.java:968) @ org.apache.jasper.runtime.pagecontextimpl.include(pagecontextimpl.java:624) @ org.apache.struts.tiles.tilesutilimpl.doinclude(tilesutilimpl.java:135) @ org.apache.struts.tiles.tilesutil.doinclude(tilesutil.java:149) @ org.apache.struts.tiles.taglib.inserttag.doinclude(inserttag.java:761) @ org.apache.struts.tiles.taglib.inserttag$inserthandler.doendtag(inserttag.java:893) @ org.apache.struts.tiles.taglib.inserttag.doendtag(inserttag.java:462) @ org.apache.jsp.web_002dinf.jsp.defaultlayout_jsp._jspx_meth_tiles_005finsert_005f1(defaultlayout_jsp.java:286) @ org.apache.jsp.web_002dinf.jsp.defaultlayout_jsp._jspservice(defaultlayout_jsp.java:115) @ org.apache.jasper.runtime.httpjspbase.service(httpjspbase.java:70) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.jasper.servlet.jspservletwrapper.service(jspservletwrapper.java:388) @ org.apache.jasper.servlet.jspservlet.servicejspfile(jspservlet.java:313) @ org.apache.jasper.servlet.jspservlet.service(jspservlet.java:260) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.applicationdispatcher.invoke(applicationdispatcher.java:646) @ org.apache.catalina.core.applicationdispatcher.processrequest(applicationdispatcher.java:436) @ org.apache.catalina.core.applicationdispatcher.doforward(applicationdispatcher.java:374) @ org.apache.catalina.core.applicationdispatcher.forward(applicationdispatcher.java:302) @ org.springframework.web.servlet.view.internalresourceview.rendermergedoutputmodel(internalresourceview.java:145) @ org.springframework.web.servlet.view.abstractview.render(abstractview.java:251) @ org.springframework.web.servlet.dispatcherservlet.render(dispatcherservlet.java:1144) @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:880) @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:793) @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:476) @ org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:431) @ javax.servlet.http.httpservlet.service(httpservlet.java:617) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:191) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:127) @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) @ org.apache.coyote.http11.http11processor.process(http11processor.java:859) @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:602) @ org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) @ java.lang.thread.run(thread.java:595)
hi drurenia, here empcalmanager requested:
public class empcalmanager { ... private list<employeecalendarvo> empcallist = lazylist.decorate(new arraylist<employeecalendarvo>(),factoryutils.instantiatefactory(employeecalendarvo.class)); public list<employeecalendarvo> getempcallist() { return empcallist; } public void setempcallist(list<employeecalendarvo> empcallist) { this.empcallist = empcallist; } ... }
this piece pulls table:
public list<employeecalendarvo> getemployeeworkcalendar(int empid, date from, date to){ session session = sessionfactory.getcurrentsession(); session.flush(); query query = session.createquery(" employeecalendarvo empwrkcdr " + "empwrkcdr.employeeid = ? , empwrkcdr.workdate between ? , ? order empwrkcdr.workdate"); query.setinteger(0, empid); query.setdate(1, from); query.setdate(2, to); return query.list(); }
any ideas? suggestions? thanks help!
*ps if codes/part of codes missing in post, kindly inform me can post them.
i found out wrong: seems set default value of column new property null
! hope others getting same error try solution out. -__-! drurenia
taking interest! :d
Comments
Post a Comment