zoukankan      html  css  js  c++  java
  • EXCEPTION-javaBean

    CreateTime--2016年11月24日14:29:43
    Author:Marydon

    声明:异常类文章主要是记录了我遇到的异常信息及解决方案,解决方案大部分都是百度解决的,(这里只是针对我遇到的做个汇总),特此声明!
    Action异常

    2016-11-12 15:17:08,931[ERROR][org.apache.struts2.dispatcher.Dispatcher]:Exception occurred during processing request: Unable to instantiate Action, jcxx.web.actions.monitor.MediDepartAction, defined for 'index' in namespace '/jcxx/server/monitor/medidepart'com.sun.proxy.$Proxy22 cannot be cast to jcxx.service.bo.config.feeitem.IBoTDICTCHARGEITEM

      spring的XML文件中的BO配置

    <!--中心药品诊疗维护-->
    <bean id="boTDICTCHARGEITEM_Jcxx" parent="txTransactionProxyJcxx">
        <property name="target">
            <bean class="jcxx.service.bo.config.feeitem.impl.BoTDICTCHARGEITEMImpl">
            <constructor-arg index="0" ref="daoTDICTCHARGEITEM_Jcxx"/>
            </bean>
        </property>
    </bean>

      解决方案:

    //service层对应的Action引入业务层接口的方法
    iBoItem = (IBoTDICTCHARGEITEM) BeansHelp.getBeanInstance("boTDICTCHARGEITEM");
    更改为:
    iBoItem = (IBoTDICTCHARGEITEM) BeansHelp.getBeanInstance("boTDICTCHARGEITEM_Jcxx");

    sqlMap异常

    com.ibatis.sqlmap.client.SqlMapException: There is no statement named xnh.config.getTDICTCODE_COUNT_test in this SqlMap.
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:232)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:510)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:494)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
    at xnh.service.dao.config.dict.impl.DaoTDICTCODEImpl.getTDICTCODE_COUNT(DaoTDICTCODEImpl.java:53)
    at xnh.service.bo.config.dict.impl.BoTDICTCODEImpl.getTDICTCODE_COUNT(BoTDICTCODEImpl.java:58)

      原因:
        sqlMap是由Dao层实现类调用的sql语句,异常的意思是:在"xnh.config"这个命名空间下没有找到id="getTDICTCODE_COUNT_test"的sql语句
    UpdateTime--2017年1月7日17:14:07
    spring异常:

    nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'boBASE_ORG_INFOImpl' of bean class [com.xyhsoft.demo.service.bo.mq.MQReceiver]: Bean property 'boBASE_ORG_INFOImpl' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

      spring对应的配置:

    <!-- 组织机构维护 -->
    <bean id="boBASE_ORG_INFOImpl" class="com.xyhsoft.demo.service.bo.organize.impl.BoBASE_ORG_INFOImpl">
        <constructor-arg index="0" ref="daoBASE_ORG_INFOImpl" />
    </bean>
    <bean id="daoBASE_ORG_INFOImpl" class="com.xyhsoft.demo.service.dao.organize.impl.DaoBASE_ORG_INFOImpl">
        <property name="sqlMapClient" ref="sqlMapClient" />
    </bean>

      原因:
        MQReceiver.java类没有set注入"boBASE_ORG_INFOImpl"
    解决方案:

    // 组织机构
    private IBoBASE_ORG_INFO boBASE_ORG_INFOImpl;
    /**
    * @param boBASE_ORG_INFOImpl
    */
    public void setBoBASE_ORG_INFOImpl(IBoBASE_ORG_INFO boBASE_ORG_INFOImpl) {
        this.boBASE_ORG_INFOImpl = boBASE_ORG_INFOImpl;
    }

    异常四(Dao层实现类出异常)

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao' defined in class path resource [com/config/userConfig.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sqlMapClient' of bean class [com.service.user.dao.impl.DaoUser]: Bean property 'sqlMapClient' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    解决方案:
      dao实现类没有继承extends SqlMapClientDaoSupport
    异常五(Bo层实现类出异常)

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userBiz' defined in class path resource [com/config/userConfig.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'userDao' of bean class [com.service.user.bo.impl.BoUser]: Bean property 'userDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    解决方案:
      spring的配置文件中,name值与要调用该对象声明的属性名保持一致

    <!-- 配置Bo,调Dao -->
    <bean id="userBo" class="com.service.user.bo.impl.BoUser">
    <!-- 此处的name值,必须与业务层实现类声明的Dao层的属性名相同 -->
      <property name="daoUser" ref="userDao"/>
    </bean>

      Bo层

    //调用dao层用户类,spring托管实例化
    private IDaoUser daoUser;
    public void setDaoUser(IDaoUser daoUserImpl) {
        this.daoUser = daoUserImpl;
    }

    异常六(set注入异常)

    Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type [com.sun.proxy.$Proxy9 implementing com.xyhsoft.demo.service.bo.dictionary.IBoBASE_DICTIONARY,
    org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.xyhsoft.demo.service.bo.organize.IBoBASE_ORG_INFO] for property 'boBASE_DICTIONARYImpl'; 
    nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.sun.proxy.$Proxy9 implementing com.xyhsoft.demo.service.bo.dictionary.IBoBASE_DICTIONARY,
    org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.xyhsoft.demo.service.bo.organize.IBoBASE_ORG_INFO] for property 'boBASE_DICTIONARYImpl': no matching editors or conversion strategy found

      原因:

    // 组织机构
    private IBoBASE_ORG_INFO boBASE_ORG_INFOImpl;
    // 字典管理
    private IBoBASE_ORG_INFO boBASE_DICTIONARYImpl;
    
    public void setBoBASE_DICTIONARYImpl(IBoBASE_ORG_INFO boBASE_DICTIONARYImpl) {
        this.boBASE_DICTIONARYImpl = boBASE_DICTIONARYImpl;
    }
    
    public void setBoBASE_ORG_INFOImpl(IBoBASE_ORG_INFO boBASE_ORG_INFOImpl) {
        this.boBASE_ORG_INFOImpl = boBASE_ORG_INFOImpl;
    }

      声明重复:同一个变量类型:IBoBASE_ORG_INFO ,不同的变量名和set方法

    UpdateTime--2017年9月4日16:30:36

    异常七(缺少jar包)

    java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException 

    解决方案:

      1.缺少jar包 commons-lang.jar;

      2.看这个jar包需要的是2.*版本,还是3.*版本,(文件存放目录不同)

  • 相关阅读:
    UVA657 The die is cast(DFS、BFS)
    三分
    【洛谷P6105】iepsmCmq
    【CF613D】Kingdom and its Cities
    【洛谷P4294】游览计划
    【洛谷P3500】TESIntelligence Test
    【洛谷P6189】[NOI Online 入门组] 跑步
    【洛谷P2973】Driving Out the Piggies
    【洛谷P3164】和谐矩阵
    【洛谷P4161】游戏
  • 原文地址:https://www.cnblogs.com/Marydon20170307/p/6524835.html
Copyright © 2011-2022 走看看