2013年10月31日星期四

SSH declare things management errors ?

1 Description:
Petty in ssh framework , configuration management declarations of things , start Tomcat error ! ! !


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. business layer



------ Solution ------------------------------------ --------
this error as yours,
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

Error Analysis: In the program, there is one with the Id in Spring Bean class conflict , namely the same name, but different types. And set and get methods exist , Spring will automatically inject Bean.
Modify the name , you can
------ For reference only ------------------------- --------------

checked according to your ideas
First, make sure the preparation of a statement of things without error
So the console information, using Kingsoft translation of the next
found UserAction.
1. property 'employeeServiceImpl'
solve this error
application.xml file contains no errors
1.web.action.UserAction wrong
No -oriented programming interface .
implementation class is used instead of interfaces ,
AoP lead agency fails
 
 private EmployeeService employeeServiceImpl = null; //业务层接口
 private String sn;
 private String password;


没有评论:

发表评论