错误日志:
org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessException details (1) are:
PropertyAccessException 1:
org.springframework.beans.TypeMismatchException: Failed to convert property value of type [com.cq.dao.impl.SysUserdaoImpl] to required type [com.cq.dao.itf.IsysUserdao] for property 'sysUserdao'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [com.cq.dao.impl.SysUserdaoImpl] to required type [com.cq.dao.itf.IsysUserdao] for property 'sysUserdao': no matching editors or conversion strategy found
Caused by: java.lang.IllegalArgumentException: Cannot convert value of type [com.cq.dao.impl.SysUserdaoImpl] to required type [com.cq.dao.itf.IsysUserdao] for property 'sysUserdao': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:815)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at com.cq.util.AppContext.<init>(AppContext.java:21)
at com.cq.util.AppContext.getInstance(AppContext.java:13)
at com.cq.actions.BaseAction.getSysUserService(BaseAction.java:14)
at com.cq.actions.LoginAction.execute(LoginAction.java:28)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
我的配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/cq/bean/SysUser.hbm.xml</value>
</list>
</property>
</bean>
<!-- 数据源 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@192.168.0.101:1521:chen"/>
        <property name="username" value="wfm"/>
        <property name="password" value="wfm"/>        
        <property name="maxActive" value="100"/>
        <property name="maxIdle" value="30"/>
        <property name="maxWait" value="1000"/>
        <property name="defaultAutoCommit" value="true"/>
        <property name="removeAbandoned" value="true"/>
        <property name="removeAbandonedTimeout" value="60"/>
    </bean>
    <!-- 服务代理 -->
    <bean id="sysUserService" abstract="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"><!--
    <property name="proxyInterfaces">
    <list>
    <value>com.springinaction.training.service.CourseService 代理实现接口 
    </value>
    </list>
    </property>-->
    <property name="transactionManager">
<ref bean="transactionManager" />
</property>
    <property name="target">
    <ref bean="sysUserTarget"/><!-- 被代理的对象 -->
    </property>
    <property name="transactionAttributes">
<props>
<prop key="find*">
PROPAGATION_REQUIRED,readOnly,-OrderException
</prop>
<!--<prop key="save*">
PROPAGATION_REQUIRED,-OrderException,-OrderMinimumAmountException
</prop>
--></props>
</property>
    </bean>
  <!-- 业务层BO -->
    <bean id="sysUserTarget"  class="com.cq.BO.Impl.SysUserImpl">
    <property name="sysUserdao">
    <ref bean="sysUserdaoImpl"/>
    </property>
    </bean>
     <!-- dao层的类 -->
    <bean id="sysUserdaoImpl" class="com.cq.dao.impl.SysUserdaoImpl">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    <!-- 事务管理 -->
  <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
   </bean>
</beans>

解决方案 »

  1.   

    看你错误,好像是类型转换的问题。通过Spring的”依赖注入“来看,应该是你的配置文件中的sysUserdao和你类中的类型不一样。你可以查询一下你的代码和配置文件中的类型一致。
      

  2.   

    Cannot convert value of type [com.cq.dao.impl.SysUserdaoImpl] to required type [com.cq.dao.itf.IsysUserdao] for property 
    看下这句 类型转换出错 应该是配置的时候 或者是你的Action属性里的set方法的对象出错 
    同意楼上