一个错误的解决:Exception thrown by getter for property author of bean buyregister

转载 2006年06月05日 16:41:00

星期一打开正在开发的系统,发现有个页面出错,后台提示是:Exception thrown by getter for property author of bean buyregister,出错处的jsp代码为:

<logic:iterate name="buyregisters" id="buyregister">
  <pg:item>
    
         <tr onmouseover="mOvr(this);" onmouseout="mOut(this);" onDblClick="dbclickItem('<bean:write name="buyregister" property="id" />')">
           <td  class = "table_td2">
               <input type="radio" name="chk" value="<bean:write name="buyregister" property="id" />" class="radio"></td>
           <td nowrap  class = "table_td2" ><bean:write  name="buyregister" property="author"/></td>
           <td nowrap  class = "table_td2" ><bean:write  name="buyregister" property="fillDateString" /></td>         
           <td nowrap  class = "table_td2" ><bean:write  name="buyregister" property="articletype" /></td>
           <td nowrap  class = "table_td2" ><bean:write  name="buyregister" property="articlename" /></td>
           <td nowrap  class = "table_td2" ><bean:write  name="buyregister" property="articlenumber"/></td>
         </tr>
       
        </pg:item>
  </logic:iterate>

仔细检查了一下代码,bo中author字段没有错、hbm.xml配置文件也没有错,在sturts配置文件中也一切正常,都匹配,这时开始怀疑是在action中没有取出buyregisters,用System.out.println()()打印了一下,发现buyregisters不为null,正百思不得其解,于是随便乱试,先把buyregisters数组中的第一个buyregister的author打印出来看看,结果页面报错:

org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.teligen.officearticle.bo.BuyRegister.setIsdraft

google了一下,有人提示说是有为null的字段,这时突然想起来上周在这个bo中增加了isdraft字段,那些旧记录的该字段的值肯定是null了,给它们赋值,再试,一切ok!从这个错误可以看出,再用buyregisters[0].getAuthor()取author值之前,hibernate会先把所有字段的值赋给buyregisters[0],然后才能取出来,有null值就会出错。

   还有,上面错误提示中有(set hibernate.cglib.use_reflection_optimizer=false for more info) ,在applicationContext.xml中设了一下:

 <prop key="hibernate.cglib.use_reflection_optimizer">false</prop>

然后把log4j.properties的提示级别改为info,重新让错误出现,这时发现后台多报了几行错误:

Caused by: net.sf.cglib.beans.BulkBeanException
        at com.teligen.officearticle.bo.BuyRegister$$BulkBeanByCGLIB$$ef4270da.setPropertyValues(<generated>)
        at org.hibernate.tuple.PojoTuplizer.setPropertyValuesWithOptimizer(PojoTuplizer.java:200)
        ... 66 more
Caused by: java.lang.NullPointerException
        ... 68 more

再和org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.teligen.officearticle.bo.BuyRegister.setIsdraft相结合考虑就能得出可能是isdraft的值为null

相关文章推荐

形如Exception thrown by getter for property XXX of bean XXX 或 No getter method for property XXX of bean XX

调试了一早上,就是老出这两个错,总算把问题找出来了,这里总结一下:教材上都是这样来讲解struts标签 logic:iterate      但是应用中我们却多会用到这样的 logic:iterate...

解决myeclipse错误:Could not create the view: An unexpected exception was thrown.

报错信息如下: at com.genuitec.eclipse.ast.deploy.core.DeploymentManager.loadFromPreferences(Unknown Sou...

Error thrown by a dependency of object 'System.Data.SQLite' 解决办法

项目中用的.net4+mvc3+spring.net1.3.2+nhibernate32+SQLite 1.0.79版本,就目前来说,应该是最新的, 在使用的时候单独用nh链接sqlite是没问题的...

Hibernate错误 Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for pnsame i

org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity...
  • revent
  • revent
  • 2014-09-03 13:43
  • 1373

SharePoint debug - Unhandled exception was thrown by the sandboxed code ...

今天打算使用Microsoft Dynamics CRM list component for Microsoft SharePoint Server 2013
  • shrenk
  • shrenk
  • 2014-11-12 01:39
  • 1045

QAxBase: Error calling IDispatch member SaveAs: Exception thrown by server Code : 1004

Qt操作Excel还真是不简单啊。网上看到一段代码可以复制excel,拿来一试。 新建Qt gui应用程序 桌面版。main.cpp代码为:#include #include "mainwind...
  • caimo
  • caimo
  • 2012-09-04 16:29
  • 8185

retrofit+Rxjava使用出现错误:Fatal Exception thrown on Scheduler.Worker thread.

错误信息:java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.

解决错误IllegalArgumentException occurred calling getter of cn.chengtech.ms.common.entity.BaseModel.id

错误如下: IllegalArgumentException in class: cn.chengtech.ms.common.entity.BaseModel,getter method of p...

exception setting property value with CGLIB 错误解决

1javax.servlet.ServletException: Error creating bean with name 'userServiceProxy' defined in class...

okhttp Fatal Exception thrown on Scheduler.Worker thread问题解决

我在项目里面同时使用了以下两个类库: compile 'com.squareup.okhttp3:logging-interceptor:3.3.1' compile 'com.squareup....
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)