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.*版本,(文件存放目录不同)
EXCEPTION-javaBean的更多相关文章
- (四)值栈与OGNL
所有的学习我们必须先搭建好Struts2的环境(1.导入对应的jar包,2.web.xml,3.struts.xml) 第一节:值栈简介 值栈是对应每个请求对象的一套内存数据的封装,Struts2 会 ...
- JSP精华知识点总结
本文转自:http://blog.csdn.net/qy1387/article/details/8050239 JSP精华知识点总结 Servlet三个要素 1.必须继承自HttpServlet 2 ...
- Servlet一些基础
Servlet 是一套规范,规定了如何通过Java代码来开发动态网站,并由 javax.servlet 和 javax.servlet.http 两个包中的类来实现. servlet是一个服务器端组建 ...
- java web 基本属性
page指令 属性 描述 默认值 language 指定JSP页面使用的脚本语言 java import contenType include指令 taglib注释 <!--我是html注释-- ...
- 初识Jsp,JavaBean,Servlet以及一个简单mvc模式的登录界面
1:JSP JSP的基本语法:指令标识page,include,taglib;page指令标识常用的属性包含Language用来定义要使用的脚本语言:contentType定义JSP字符的编码和页面响 ...
- json、javaBean、xml互转的几种工具介绍
json.javaBean.xml互转的几种工具介绍 转载至:http://blog.csdn.net/sdyy321/article/details/7024236 工作中经常要用到Json.Jav ...
- java高新技术-操作javaBean
1. 对javaBean的简单内省操作 public class IntroSpectorTest { public static void main(String[] args) throws Ex ...
- jsp 以及javabean内省技术
l JSP l JavaBean及内省 l EL表达式 1.1 上次课内容回顾 会话技术: Cookie:客户端技术.将数据保存在客户端浏览器上.Cookie是有大小和个数的限制. Session:服 ...
- ireport5.6+jasperreport6.3开发(五)--以javabean为基准的报表开发(action关联)
这里的是定方法主要参照sturts2-jasperreport-plugin的完成方法(其实就是抄的) PDF的样子是这样的两页的pdf 然后action的配置是这样的(不要在意格式) @Parent ...
- javabean连数据库
1.在src下建包,然后包中建javabean类,代码如下(我的包名为aa) package aa; import java.sql.*; public class bean { private fi ...
随机推荐
- Windows Phone Silverlight 8.1 apps
The Windows Phone Silverlight 8.1 app model gives Windows Phone 8 developers access to some of the n ...
- C#引用类型转换,到底使用is,as还是显式强转?
在C#中,当引用类型需要转换的时候,经常会用到关键字is.as以及显式强转.本篇来体验这三者的用法. 先来梳理.NET引用类型转换的"约定俗成",或者叫"惯例" ...
- 【甘道夫】通过Mahout构建推荐系统--通过IDRescorer扩展评分规则
通过Mahout构建推荐系统时,假设我们须要添�某些过滤规则(比方:item的创建时间在一年以内),则须要用到IDRescorer接口,该接口源代码例如以下: package org.apache.m ...
- 【BZOJ】【2752】【HAOI2012】高速公路(Road)
数学期望/线段树 然而又是一道road= =上一道是2750…… 下次不要一看期望题就弃疗么…… 期望题≠不可做题……!! 其实在这题中,期望就是(所有情况下 权值之和)/(总方案数) 因为是等概率抽 ...
- spark-submit提交作业过程
1. 作业提交方法以及参数 我们先看一下用Spark Submit提交的方法吧,下面是从官方上面摘抄的内容. # Run application locally on 8 cores ./bin/sp ...
- GUI程序设计
1. 对话框(JDialog)使用示例 例1. JDialog简单使用示例. import javax.swing.JLabel; public class demoJDialog { JFrame ...
- Objective-C:Objective-C:文件中一些对目录进行操作的函数
IO文件中,一些对目录进行操作的函数:获取.切分.组合 一些对目录进行操作的函数: 获取用户的姓名:(NSString*)NSUserName() ; ———>NSString *Str ...
- Java---多线程断点下载
在上一章中我们实现了多线程下载功能,这里我们添加断点下载功能,防止下载过程中程序意外退出.具体代码如下: package com.jwzhangjie; /** * 说明: * 每一个线程下载的位置计 ...
- js中replace的用法
replace方法的语法是:stringObj.replace(rgExp, replaceText) 其中stringObj是字符串(string),reExp可以是正则表达式对象(RegExp)也 ...
- 邮件发送(C#)
using System;using System.Collections.Generic;using System.Text;using System.Net.Mail;using System.N ...