首页 技术 正文
技术 2022年11月16日
0 收藏 776 点赞 3,064 浏览 5387 个字

 

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.*版本,(文件存放目录不同)

 

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,082
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,557
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,406
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,179
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,815
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,898