type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception Unable to instantiate Action, com.rj0812.action.user.UserAddAction,  defined for 'UserAddAction' in namespace '/user'Failed to convert property value of type [$Proxy10 implementing com.rj0812.service.NewscolService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.rj0812.service.UserService] for property 'newscolService'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy10 implementing com.rj0812.service.NewscolService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.rj0812.service.UserService] for property 'newscolService': no matching editors or conversion strategy found
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:307)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
root cause org.springframework.beans.TypeMismatchException: Failed to convert property value of type [$Proxy10 implementing com.rj0812.service.NewscolService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.rj0812.service.UserService] for property 'newscolService'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy10 implementing com.rj0812.service.NewscolService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.rj0812.service.UserService] for property 'newscolService': no matching editors or conversion strategy found
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:182)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:162)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:133)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)
root cause java.lang.IllegalArgumentException: Cannot convert value of type [$Proxy10 implementing com.rj0812.service.NewscolService,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] to required type [com.rj0812.service.UserService] for property 'newscolService': no matching editors or conversion strategy found
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
com.opensymphony.xwork2.spring.SpringObjectFactory.autoWireBean(SpringObjectFactory.java:182)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:162)
com.opensymphony.xwork2.spring.SpringObjectFactory.buildBean(SpringObjectFactory.java:133)
com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:139)
com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:109)
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:288)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:388)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:187)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)

解决方案 »

  1.   

    [com.rj0812.service.UserService] for property 'newscolService'
      

  2.   

    无法实例化这个'UserAddAction' 
      

  3.   

    我加入service后出现的这个情况,这个我的<bean id="userService" class="com.rj0812.service.imp.UserServiceImp">
    <property name="userDao">
    <ref bean="userDao"/>
    </property>
    </bean>
    还有<bean id="userDao" class="com.rj0812.dao.imp.UserDaoImp">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>,这个是action中private UserService userService;
    private static final long serialVersionUID = -4134661411623487672L;
    private TUser user = new TUser();
    public void setNewscolService(UserService userService) {
    this.userService = userService;
    }
    public String execute(){
    System.out.println(user.getFUserid());
    System.out.println(user.getFUserpassword());
    System.out.println(user.getFUsertype());
    return SUCCESS;
    }
    public TUser getModel() {
    // TODO Auto-generated method stub
    return user;
    }我还没有使用service呢,为什么就有错误了呢?
      

  4.   

    spring配置文件里的UserAction里的UserService属性不匹配吧??
    把 UserAction 源码和 spring配置文件贴出来看看。。
      

  5.   

    错误的含义是 不能把 com.rj0812.service.NewscolService 转换成
    com.rj0812.service.UserService
      

  6.   

    public class UserAddAction extends ActionSupport implements ModelDriven<TUser>{
    private UserService userService;
    private static final long serialVersionUID = -4134661411623487672L;
    private TUser user = new TUser();
    public void setNewscolService(UserService userService) {
    this.userService = userService;
    }
    public String execute(){
    System.out.println(user.getFUserid());
    System.out.println(user.getFUserpassword());
    System.out.println(user.getFUsertype());
    return SUCCESS;
    }
    public TUser getModel() {
    // TODO Auto-generated method stub
    return user;
    }
    },<?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: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"> <import resource="applicationContext-dao.xml" />
    <import resource="applicationContext-service.xml" />

    <!-- 定义数据源Bean -->

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <property name="driverClass" value="com.mysql.jdbc.Driver" />
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/db_newsmanage" /><!--  --> <property name="user" value="root" />
    <property name="password" value="1" /><!-- soft --> <!-- 连接关闭时默认将所有未提交的操作回滚。默认为false -->
    <property name="autoCommitOnClose" value="true" /> <!-- 连接池中保留的最小连接数-->
    <property name="minPoolSize" value="10" /> <!-- 连接池中保留的最大连接数。默认为15 -->
    <property name="maxPoolSize" value="15" /> <!-- 初始化时获取的连接数,取值应在minPoolSize与maxPoolSize之间。默认为3 -->
    <property name="initialPoolSize" value="10" /> <!-- 最大空闲时间,超过空闲时间的连接将被丢弃。为0或负数则永不丢弃。默认为0秒 -->
    <property name="maxIdleTime" value="60" /> <!-- 当连接池中的连接用完时,C3P0一次性创建新连接的数目。默认为3 -->
    <property name="acquireIncrement" value="3" /> <!-- 定义在从数据库获取新连接失败后重复尝试获取的次数,默认为30 -->
    <property name="acquireRetryAttempts" value="3" /> <!--
    当连接池用完时客户端调用getConnection()后等待获取新连接的时间,超时后将抛出SQLException,如设为0则无限期等待。单位毫秒,默认为0
    -->
    <property name="checkoutTimeout" value="10000" />
    </bean> <!-- 定义Hibernate的SessionFactory -->
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <!-- 依赖注入SessionFactory的数据源 ,正是上文定义好的那个-->
    <property name="dataSource">
    <ref bean="dataSource" />
    </property> <!-- 指定Hibernate的连接方言及其他属性 -->
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    <!-- mappingDirectoryLocations指定存放映射文件的目录 -->
    <property name="mappingDirectoryLocations">
    <list>
    <value>classpath:com/rj0812/bean</value>
    </list>
    </property>
    </bean>
    <!--注入sessionFactory-->
    <bean id="transactionManager" 
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    <!--对do开头的方法进行事务监管-->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
    <tx:method name="do*" propagation="REQUIRED"/>
    <tx:method name="*" propagation="SUPPORTS" read-only="true"/>
    </tx:attributes>
    </tx:advice>

    <aop:config>
    <aop:pointcut id="allManagerMethod" expression="execution(* com.rj0812.service.*.*(..))"/>
    <aop:advisor pointcut-ref="allManagerMethod" advice-ref="txAdvice"/>
    </aop:config>
    </beans>
      

  7.   

    private UserService userService
    是否是把UserService 的包导入错了??
      

  8.   

    import com.rj0812.service.UserService;package com.rj0812.service;import com.rj0812.bean.TUser;public interface UserService {
    /*添加用户*/
    public boolean doAddUser(TUser user);
    }
    就是这个包啊
      

  9.   

    package com.rj0812.action.user;import com.opensymphony.xwork2.ActionContext;
    import com.opensymphony.xwork2.ActionSupport;
    import com.opensymphony.xwork2.ModelDriven;
    import com.rj0812.bean.TUser;
    import com.rj0812.dao.UserDao;
    import com.rj0812.service.UserService;
      

  10.   

    lz全局查找 com.rj0812.service.NewscolService 
    看看你是不是在什么地方配置了这个。。
      

  11.   

    请问你的qq号多少我加你qq行不?
      

  12.   

    我怀疑是你这里有问题:
    public void setNewscolService(UserService userService) {
       this.userService = userService;
    }
    如果你把Service的实例化工作交给Spring的话,setter方法的名字应该写成:setUserService();因为Spring是根据setter 后面的名称为属性赋值的,写成别的Spring就找不到了!试试吧!