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
小资 ,在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
解决方案 »
- 新手,hibernate配置问题
- 第一次整合SSH 出现了一个奇怪的问题 大家看看
- Oracle 中的setexecutebatch(int)当中的参数含义是什么?
- javascript,实现一个功能,文本框内只能输入数字。。
- jfreechart如何在横向的某一个刻度平行画一条线
- 哪位能提供个abator生成ibatis, 连接oracle的demo
- 用myeclipse做struts时出现 Warning: Superclass
- 配置连接池时,获取数据库端口号?
- 请教一个框架性问题,紧急寻求解决方案
- 求一个完整OA项目java代码(急急急)
- netty服务器端异常
- JAVA,求两个集合的差集
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。
根据需要修改命名,即可
按你思路检查了
首先,确保了声明事物的配制没有错误
于是将控制台信息,用金山翻译了下
发现是 UserAction. <bean>
1. property 'employeeServiceImpl'
这个错误解决了
application.xml 文件没有错误
1.web.action.UserAction 出错了
没有面向接口编程。
用的是实现类而不是接口,
AoP导致代理失败了
private EmployeeService employeeServiceImpl = null; //业务层接口
private String sn;
private String password;