Error creating bean with name 'AdminShowUser' defined in ServletContext resource [/WEB-INF/classes/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'adminService' of bean class [cn.cslg.action.AdminShowUser]: Bean property 'adminService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?我在做学生购书系统,发布后出现这个错  求解ssh

解决方案 »

  1.   

    你确认下你的application.xml中的bean配置的是否正确,每个类对应的所在类的包名是否是正确的。
      

  2.   

    <!-- 注入AdminDao -->
    <bean id="adminDao" class="cn.cslg.dao.impl.AdminDaoImpl">
    <property name="sessionFactory">
    <ref bean="sessionFactory"/>
    </property>
    </bean>

    <bean id="adminService" class="cn.cslg.service.impl.AdminServiceImpl">
    <property name="adminDao">
    <ref bean="adminDao"/>
    </property>
    </bean>

    <bean id="AdminAction" class="cn.cslg.action.AdminAction">
    <property name="adminService">
    <ref bean="adminService"/>
    </property>
    </bean>

    <bean id="AdminShowUser" class="cn.cslg.action.AdminShowUser">
    <property name="adminService">
    <ref bean="adminService"/>
    </property>
    </bean>
    这个是代码,您帮忙看下
      

  3.   

    这个是struts.xml<!-- 管理员登陆 --> 
         <action name="AdminLogin" class="cn.cslg.action.AdminAction" method="AdminLogin">
           <result name="success">/pages/AdminLogin_success.jsp</result>
       <result name="error">AdminLogin.jsp</result>
     </action>
    <!-- 管理员登离 --> 
         <action name="AdminLogout" class="cn.cslg.action.AdminAction" method="AdminLogout">
           <result name="success">/pages/Logout_success.jsp</result>
     </action> <!-- 显示所有用户 --> 
         <action name="AdminShowUser" class="cn.cslg.action.AdminShowUser">
           <result name="success">/pages/ShowUsers.jsp</result>
           <result name="error">/pages/AdminError.jsp</result>
     </action>能够登录,但是登离和显示就不行
     
      

  4.   

    你的AdminServiceImpl.java有没有adminDao的setter方法。肯定没有或是名字不是
    setAdminDao
      

  5.   

    找到了,没继承extends HibernateDaoSupport,菜鸟伤不起啊,谢诸位