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方法

时间: 2024-08-20 16:08:58

EXCEPTION-javaBean的相关文章

Servlet一些基础

Servlet 是一套规范,规定了如何通过Java代码来开发动态网站,并由 javax.servlet 和 javax.servlet.http 两个包中的类来实现. servlet是一个服务器端组建,可以用来扩展任何运行在JAVA 的服务器的功能,也本质上讲它就是一个JAVA 文件,用来写功能的 Servlet三个要素: 1.必须继承自HttpServlet 2.必须实现doGet()或者doPost() 3.必须在web.xml中配置Servlet <servlet> <servle

sparkStreaming_电商案例

数据生成: package com.java__SparkStreaming; import kafka.javaapi.producer.Producer; import kafka.producer.KeyedMessage; import kafka.producer.ProducerConfig; import java.util.*; /** * Created by Administrator on 2016/7/12. */ public class MockAdClickedSt

jsp入门总结

Servlet三要素: 1.必须继承自HttpServlet 2.必须实现doGet()或者doPost() 3.必须在web.xml中配置Servlet <servlet> <servlet-name>xxx</servlet-name> <servlet-class>包名+类名</servlet-class> </servlet> <servlet-mapping> <servlet-name>必须与上面的

JAVA中反射机制五(JavaBean的内省与BeanUtils库)

内省(Introspector) 是Java 语言对JavaBean类属性.事件的一种缺省处理方法. JavaBean是一种特殊的类,主要用于传递数据信息,这种类中的方法主要用于访问私有的字段,且方法名符合某种命名规则.如果在两个模块之间传递信息,可以将信息封装进JavaBean中,这种对象称为“值对象”(Value Object),或“VO”.方法比较少.这些信息储存在类的私有变量中,通过set().get()获得. 例如类UserInfo : package com.peidasoft.in

JAVAWEB开发之Session的追踪创建和销毁、JSP详解(指令,标签,内置对象,动作即转发和包含)、JavaBean及内省技术以及EL表达式获取内容的使用

Session的追踪技术 已知Session是利用cookie机制的服务器端技术,当客户端第一次访问资源时 如果调用request.getSession() 就会在服务器端创建一个由浏览器独享的session空间,并分配一个唯一且名称为JSESSIONID的cookie发送到浏览器端,如果浏览器没有禁用cookie的话,当浏览器再次访问项目中的Servlet程序时会将JSESSIONID带着,这时JSESSIONID就像唯一的一把钥匙  开启服务器端对应的session空间,进而获取到sessi

javaBean与Map&lt;String,Object&gt;互转

1. 为什么要实现javaBean与Map<String,Object>相互转换? 用过spring的都知道spring的MVC框架中有一个BaseCommandController对象,利用这个对象我们就可以很方便的将从客户端传递过来的参数封装到一个JavaBean对象中去,而不需要我们request.getParameter("name");bean.setName(name);了,从而也简化了不少的工作.如果大家用过BeanUtils.populate的话,就知道,这

Spring(二)Spring对JavaBean的管理

部分与第一篇重复的内容省掉了. 用实体类保存JavaBean的配置信息 package test.spring.entity; public class Bean { private String id; private String classPath; public Bean(String id, String classPath) { super(); this.id = id; this.classPath = classPath; } public String getId() { r

Java Jaxb JavaBean与XML互转

1.Jaxb - Java Arcitecture for XML Binding 是业界的一个标准,是一项可以根据XML Schema产生Java类的技术. Jaxb2.0是Jdk1.6的组成部分.不需要在第三方Jar包的支持下即可完成Xml与JavaBean的相互转换. 2.重要概念: ·JAXBContext类,是应用的入口,用于管理XML/Java绑定信息. ·Marshaller接口,将Java对象序列化为XML数据. ·Unmarshaller接口,将XML数据反序列化为Java对象

JDBC高级应用 - DAO模式与JavaBean

DAO模式与JavaBean DAO数据库操作对象(Data Access Object):负责连接数据库,通过集合获取数据库中的数据,对数据进行CRUD的操作. DAO出现之前,操作数据库的代码与业务代码都出现在JSP或Servlet中,不利于业务代码的分离.DAO出现后改变了这一情况,所有与数据库相关的操作都被拿到了DAO层实现,Servlet或JSP中只操作JavaBean与DAO层,而DAO只操作数据库. 事务实例:转账 张三转200元到李四的银行账户,李四要买英雄联盟皮肤. 要分两个步

JDK1.5的新特性:javabean、注解类、类加载器

关于Java基础的文章,我觉得写得还可以,以前发在了我其它的博客了,肯定是原创,现在再分享给大家出来. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------