1.描述:
 小资 ,在ssh 框架,配置声明事物管理后,启动Tomcat 报错!!!
Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy0 implementing service.EmployeeService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [service.impl.EmployeeServiceImpl] for property 'employeeServiceImpl'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy0 implementing service.EmployeeService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [service.impl.EmployeeServiceImpl] for property 'employeeServiceImpl': no matching editors or conversion strategy found
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)2.application.xml<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
">

<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation"
value="classpath:hibernate.cfg.xml">
</property>
</bean>

<!-- 配置Hibernate的管理实务 -->
     <bean id= "txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
      <property name="sessionFactory" ref="sessionFactory"></property>
     </bean>
     
     <tx:advice id ="txAdvice" transaction-manager="txManager">
       <tx:attributes>
           <tx:method name="get*" read-only="true"/>
           <tx:method name="find*" read-only="true"/>
           <tx:method name="search*" read-only="true"/>
           <tx:method name="query*" read-only="true"/>
           <tx:method name="add*" propagation="REQUIRED"/>
           <tx:method name="del*" propagation="REQUIRED"/>
           <tx:method name="update*" propagation="REQUIRED"/>
           <tx:method name="do*" propagation="REQUIRED"/>
           <tx:method name="*"   read-only = "true"/>
       </tx:attributes>
     </tx:advice>
     
     <!-- aop -->
     <aop:config>
         <aop:pointcut id = "serviceMethod" expression = "execution(* service.impl.*.*(..))"></aop:pointcut>
         <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethod"></aop:advisor>
     </aop:config>
     
     
     


    <bean id= "userDao" class="dao.impl.EmployeeOperimpl">
        <property name="sessionFactory" ref= "sessionFactory"></property>
    </bean>
   
   <bean id = "userBiz" class="service.impl.EmployeeServiceImpl">
       <property name="employeeDao" ref="userDao"></property>
   </bean>    
   
   <bean id = "userAction" class= "web.action.userAction">
      <property name="employeeServiceImpl" ref="userBiz"/>
   </bean>
    

</beans>
3.业务层
sshtomcat

解决方案 »

  1.   

    这个错误和你的很像
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [cn.edu.tjuci.ei_oa.biz.baseInfo.impl.OfficeInfoBizImpl] to required type [cn.edu.tjuci.ei_oa.bean.OfficeInfo] for property 'officeInfo'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [cn.edu.tjuci.ei_oa.biz.baseInfo.impl.OfficeInfoBizImpl] to required type [cn.edu.tjuci.ei_oa.bean.OfficeInfo] for property 'officeInfo': no matching editors or conversion strategy found 错误分析:在程序中,存在一个与Spring中Bean的Id冲突的类,即名称相同,但是类型不同。并且同时存在set和get方法,Spring会自动注入Bean。 
    根据需要修改命名,即可 
      

  2.   


    按你思路检查了
    首先,确保了声明事物的配制没有错误
    于是将控制台信息,用金山翻译了下
    发现是 UserAction. <bean>
    1. property 'employeeServiceImpl'
    这个错误解决了
    application.xml 文件没有错误
    1.web.action.UserAction 出错了
    没有面向接口编程。
    用的是实现类而不是接口,
    AoP导致代理失败了 
     
     private EmployeeService employeeServiceImpl = null; //业务层接口
     private String sn;
     private String password;