下面配置文件红色字体把*去了就不报错,加上*想把所有Service都加上事务控制,就报错了。
怎么改?谢谢!错误信息:
Caused by: java.lang.IllegalStateException: Cannot convert value of type [$Proxy4 implementing com.gage.framework.service.BaseBusinessService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.icss.oa.service.CheckUserService] for property 'checkUserService': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:233)
at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:466)
... 32 more配置文件:
<?xml version="1.0" encoding="UTF-8"?><!-- - Application context definition for JPetStore's business layer. - Contains 
bean references to the transaction manager and to the DAOs in - dataAccessContext-local/jta.xml 
(see web.xml's "contextConfigLocation"). -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url"
value="jdbc:mysql://192.168.1.105:3306/AidanceOA?characterEncoding=UTF-8"></property>
<property name="username" value="root"></property>
<property name="password" value=""></property>
<property name="maxActive" value="100"></property>
<property name="maxIdle" value="30"></property>
<property name="maxWait" value="500"></property>
<property name="defaultAutoCommit" value="true"></property>
</bean> <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean> <bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean> <tx:annotation-driven transaction-manager="transactionManager"
proxy-target-class="true" /> <bean id="onlineServiceTransactionInterceptor"
class="org.springframework.transaction.interceptor.TransactionInterceptor">
<property name="transactionManager">
<ref bean="transactionManager" />
</property>
<property name="transactionAttributes">
<props>
<prop key="businessProcess">
PROPAGATION_REQUIRED,-Exception
</prop>
</props>
</property>
</bean> <bean
class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
<property name="beanNames">
<list>
<value>*Service</value> </list>
</property>
<property name="interceptorNames">
<list>
<value>onlineServiceTransactionInterceptor</value>
</list>
</property>
</bean>
</beans>

解决方案 »

  1.   

    很明显,mappedName不匹配的
    也就是说你的mappedName并不是Service结尾的
      

  2.   


     下面是我的一个service的配置<?xml version="1.0" encoding="UTF-8"?><!-- - Application context definition for JPetStore's business layer. - Contains 
    bean references to the transaction manager and to the DAOs in - dataAccessContext-local/jta.xml 
    (see web.xml's "contextConfigLocation"). -->
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
    <bean id="checkUserService" class="com.icss.oa.service.CheckUserService"
    scope="prototype" >
    <property name="userDAO" ref="userDAO" />
    </bean>

    </beans>下面是action配置
    <?xml version="1.0" encoding="UTF-8"?><!-- - Application context definition for JPetStore's business layer. - Contains 
    bean references to the transaction manager and to the DAOs in - dataAccessContext-local/jta.xml 
    (see web.xml's "contextConfigLocation"). -->
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
               
    <!-- 在此name对应struts配置中的path --> <bean name="loginAction" class="com.icss.oa.controller.LoginAction">
    <property name="checkUserService" ref="checkUserService" />
    </bean> <bean name="userMessageAction" class="com.icss.oa.controller.UserMessageAction">
    </bean> <bean name="systemManagerAction" class="com.icss.oa.controller.SystemManagerAction">
    </bean>
    </beans>请帮帮忙在给看看
      

  3.   


    我感觉这种写法比较省事,所有的service都继承一个父类,父类提供一个public的方法,service执行都用这个public方法businessProcess,事务控制全部加在这个方法上面。
      

  4.   

    我解决了CheckUserServiceImpl需要一个CheckUserService接口,我原来想写一个baseInterface不要CheckUserService这层,看来aop不让。