`
houzhaowei
  • 浏览: 493120 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ssh 开发中出现的异常_1

阅读更多
--------------------1----------------------

exception is org.springframework.beans.NotWritablePropertyException:
Invalid property 'sessionFactory' of bean class [com.actions.ProvinceAction]: Bean property
'sessionFactory' is not writable or has an invalid setter method. Does the para
meter type of the setter match the return type of the getter?:

------异常原因:一个bean 用到sessionFactory 属性,而该bean里面没有写sessionFactory 的
get/set方法。

--------------------2----------------------
2009-03-23 16:12:54.568::WARN:  Nested in org.apache.jasper.JasperException: tag
'select', field 'list', name 'resume.province.id': The requested list key 'prov
inces' could not be resolved as a collection/array/map/enumeration/iterator type
. Example: people or people.{name} - [unknown location]:

-------一直头疼恶心的错误, action 中有provinces属性  这里却找不到。  原因:
如果从action 到struts标签都没错的话  就是在 get  provinces属性 底层出现了异常。
而这里不打印异常栈
解决方法:异常打印不出来,而底层确实有出错的异常栈。我的解决方法是逐层分析。
感觉可能是哪部份出现的异常,先删除或者跳过那部分代码执行程序,如果没异常,说明
异常出现在该代码段。反之继续用此方法调试。

如 我的action中给provinces 属性赋值的方法是

    public List<Province> getProvinces() {
        if( provinces == null ){
            provinces = provinceDao.getAllProvinces();
        }
        return provinces;
    }

我先注释掉于底层打交道的代码 即
    if( provinces == null ){
            provinces = provinceDao.getAllProvinces();
    }
    然后new 一个List 看看是否还有异常。若没有异常 则取消注释   继续到getAllProvinces
方法中,同样利用此方法调试。

-----------------------

------如果没有spring 集成,hibernate 配置文件在sessionFactory  = new Configuration().configure().buildSessionFactory();  这句话时被读取。

-----------------------
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics