Unable to instantiate Action, loginAction,  defined for 'login_login' in namespace '/'Error creating bean with name 'loginAction' defined in ServletContext resource [/WEB-INF/applicationContext-struts.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [cn.ljw.service.impl.LoginServiceImpl] to required type [cn.ljw.service.login.LoginService] for property 'loginService'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [cn.ljw.service.impl.LoginServiceImpl] to required type [cn.ljw.service.login.LoginService] for property 'loginService': no matching editors or conversion strategy found
com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:306)
com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:387)
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
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:458)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)

解决方案 »

  1.   

    applicationContext-struts.xml 这个发一下.
      

  2.   

    我用四个啊
    applicationContext-dao.xml
    applicationContext-resource.xml
    applicationContext-service.xml
    applicationContext-struts.xml
      

  3.   


         applicationContext-dao.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:context="http://www.springframework.org/schema/context"
           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.5.xsd
               http://www.springframework.org/schema/context
               http://www.springframework.org/schema/context/spring-context-2.5.xsd
               http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
               
            <bean id="loginDao" class="cn.ljw.dao.impl.LoginDaoImpl">
               <property name="sessionFactory" ref="sessionFactory"/>
            </bean></beans>
      

  4.   

    applicationContext-resource.xml中 <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
    <property name="driverClass" value="org.gjt.mm.mysql.Driver"/>
    <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/information_data?useUnicode=true&amp;characterEncoding=utf-8"/>
    <property name="user" value="root"/>
    <property name="password" value="123456"/>
    </bean>
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
     <property name="mappingResources">
        <list>
         
          <value>cn/ljw/entity/TblUser.hbm.xml</value>
          
        </list>
    </property>
     <property name="hibernateProperties">
     <value>
          hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
          hibernate.hbm2ddl.auto=update
          hibernate.show_sql=false
          hibernate.format_sql=false
      </value>
     </property>
    </bean>
    <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory"/>
    </bean>
    </beans>
      

  5.   

    Failed to convert property value of type [cn.ljw.service.impl.LoginServiceImpl] to required type [cn.ljw.service.login.LoginService] for property 'loginService';
    这个问题,loginService 对应的类型有问题。请lz再看下是不是这写错了
      

  6.   

    什么是loginService对应的类型,是不是它对应的class吗?