公司前期请了外包公司做了一个企业级系统,应用的是SSI轻量级系统,现在公司要我增加一个新功能,但是无论怎么配置框架,都报错,求大神指导,解决问题者以身相许,本人为图像图片
这是/src/struts,xml文件:
<!-- 文件阅读群组管理 -->这是外包公司写的
<include file="struts2config/readgrpmanage.xml"></include>
<!-- 文件替换管理 -->这是我写的
<include file="struts2config/replacefilemanage.xml"></include>
这是/src/struts2config/replacefilemanage.xml:
<struts>
<package namespace="/replacefilemanage" name="replacefilemanage" extends="base">
<action name="getReplaceFileRecordList" class="ReplaceFileManageAction" method="getReplaceFileRecordList">
<result>/views/systemManage/replaceFileManage/replaceFileRecordList.jsp</result>
</action>
</package>
</struts>
Spring的配置如下:
1、/src/config/applicationContext-action.xml
<!-- 文件阅读群组管理action -->这是外包公司写的
<bean id="ReadgrpManageAction"class="com.cc.dcc.struts2.actions.ReadgrpManageAction" scope="prototype">
<property name="readgrpManageService" ref="readgrpManageService"></property>
<property name="categoryService" ref="categoryService"></property>
<property name="logmanageservice" ref="logmanageservice"></property>
<property name="categoryRecordRightService" ref="categoryRecordRightService"></property>
</bean>
<!-- 文件替换管理action -->这是我写的
<bean id="ReplaceFileManageAction"class="com.cc.dcc.struts2.actions.ReplaceFileManageAction" scope="prototype">
<property name="replacefileManageService" ref="replacefileManageService"></property>
<property name="categoryService" ref="categoryService"></property>
<property name="logmanageservice" ref="logmanageservice"></property>
<property name="categoryRecordRightService" ref="categoryRecordRightService"></property>
</bean>
2、/src/config/applicationContext-service.xml:
<!-- 阅读群组管理Service -->这是外包公司写的
<bean id="readgrpManageService" class="com.cc.dcc.services.impl.ReadgrpManageServiceImpl" autowire="byName">
   <property name="documentmanageservice" ref="documentmanageservice"/>
   <property name="documentRecordRightService" ref="documentRecordRightService"/>
   <property name="categoryService" ref="categoryService"></property>
   <property name="categoryRecordRightService" ref="categoryRecordRightService"></property>
</bean>
<!-- 文件替换管理Service -->这是我写的
<bean id="replacefileManageService" class="com.cc.dcc.services.impl.ReplaceFileManageServiceImpl" autowire="byName">
   <property name="documentmanageservice" ref="documentmanageservice"/>
   <property name="documentRecordRightService" ref="documentRecordRightService"/>
   <property name="categoryService" ref="categoryService"></property>
   <property name="categoryRecordRightService" ref="categoryRecordRightService"></property>
</bean>
一样的写法,我甚至COPY了可以运行的方法和类但是,运行起来网页还是报错,报错情况如下:
1、Invalid property 'replacefileManageService' of bean class [com.cc.dcc.struts2.actions.ReplaceFileManageAction]: Bean property 'replacefileManageService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
2、Error creating bean with name 'ReplaceFileManageAction' defined in class path resource [config/applicationContext-action.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'replacefileManageService' of bean class [com.cc.dcc.struts2.actions.ReplaceFileManageAction]: Bean property 'replacefileManageService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
3、Unable to instantiate Action, ReplaceFileManageAction, defined for 'getReplaceFileRecordList' in namespace '/replacefilemanage'Error creating bean with name 'ReplaceFileManageAction' defined in class path resource [config/applicationContext-action.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'replacefileManageService' of bean class [com.cc.dcc.struts2.actions.ReplaceFileManageAction]: Bean property 'replacefileManageService' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
跪求大神啊,以身相许,,,javaee框架struts2

解决方案 »

  1.   

    检查一下 com.cc.dcc.services.impl.ReadgrpManageServiceImpl 的属性,是否和
       <property name="documentmanageservice" ref="documentmanageservice"/>
       <property name="documentRecordRightService" ref="documentRecordRightService"/>
       <property name="categoryService" ref="categoryService"></property>
       <property name="categoryRecordRightService" ref="categoryRecordRightService"></property>
    对应的起来,注意大小写。
      

  2.   

    好像是对应的,因为我是直接COPY的ReadgrpManage这个方法的所有类,去改写我自己的方法ReplaceFileManage;这是相应代码:
    public class ReplaceFileManageServiceImpl extends BaseServiceImpl implements IReplaceFileManageService{
    private IDocumentManageService documentmanageservice; 
    private IDocumentRecordRightService documentRecordRightService;
    private ICategoryService categoryService;
    private ICategoryRecordRightService categoryRecordRightService;
      

  3.   

    有的有驼峰有的木有:documentmanageservice 
    把你的 get set 也都贴一下,大家帮你看看
      

  4.   

    这就是属性的get和set方法:
    public IReplaceFileManageService getreplaceFileManageService() {
    return replaceFileManageService;
    } public void setreplaceFileManageService(IReplaceFileManageService replaceFileManageService) {
    this.replaceFileManageService = (IReplaceFileManageService) replaceFileManageService;
    } public ICategoryService getCategoryService() {
    return categoryService;
    } public void setCategoryService(ICategoryService categoryService) {
    this.categoryService = categoryService;
    } public String getCategoryId() {
    return categoryId;
    } public void setCategoryId(String categoryId) {
    this.categoryId = categoryId;
    } public Paginator<DccReadgrpUpd> getPaginator() {
    return paginator;
    } public void setPaginator(Paginator<DccReadgrpUpd> paginator) {
    this.paginator = paginator;
    } public String getCategoryFullPath() {
    return categoryFullPath;
    } public void setCategoryFullPath(String categoryFullPath) {
    this.categoryFullPath = categoryFullPath;
    } public DccReadgrpUpd getReadgrpUpd() {
    return readgrpUpd;
    } public void setReadgrpUpd(DccReadgrpUpd readgrpUpd) {
    this.readgrpUpd = readgrpUpd;
    } public String getFileInfosReadgrp() {
    return fileInfosReadgrp;
    } public void setFileInfosReadgrp(String fileInfosReadgrp) {
    this.fileInfosReadgrp = fileInfosReadgrp;
    } public String getRoleInfos() {
    return roleInfos;
    } public void setRoleInfos(String roleInfos) {
    this.roleInfos = roleInfos;
    } public String getDownloadroleInfos() {
    return downloadroleInfos;
    } public void setDownloadroleInfos(String downloadroleInfos) {
    this.downloadroleInfos = downloadroleInfos;
    } public List<Role> getRoleList() {
    return roleList;
    } public void setRoleList(List<Role> roleList) {
    this.roleList = roleList;
    } public List<Role> getDownloadRoleList() {
    return downloadRoleList;
    } public void setDownloadRoleList(List<Role> downloadRoleList) {
    this.downloadRoleList = downloadRoleList;
    } public String getIds() {
    return ids;
    } public void setIds(String ids) {
    this.ids = ids;
    } public String getSubmitTimeStart() {
    return submitTimeStart;
    } public void setSubmitTimeStart(String submitTimeStart) {
    this.submitTimeStart = submitTimeStart;
    } public String getSubmitTimeEnd() {
    return submitTimeEnd;
    } public void setSubmitTimeEnd(String submitTimeEnd) {
    this.submitTimeEnd = submitTimeEnd;
    } public String getLinkflag() {
    return linkflag;
    } public void setLinkflag(String linkflag) {
    this.linkflag = linkflag;
    } public ILogManageService getLogmanageservice() {
    return logmanageservice;
    } public void setLogmanageservice(ILogManageService logmanageservice) {
    this.logmanageservice = logmanageservice;
    } public String getHasCategoryRight() {
    return hasCategoryRight;
    } public void setHasCategoryRight(String hasCategoryRight) {
    this.hasCategoryRight = hasCategoryRight;
    } public ICategoryRecordRightService getCategoryRecordRightService() {
    return categoryRecordRightService;
    } public void setCategoryRecordRightService(
    ICategoryRecordRightService categoryRecordRightService) {
    this.categoryRecordRightService = categoryRecordRightService;
    }

    }
      

  5.   

    可能就是名字写错了,报的错误已经很清楚了,
    ean property 'replacefileManageService' is not writable or has an invalid setter method.set方法不对,你用自动生成的set
      

  6.   

    public IReplaceFileManageService getreplaceFileManageService() {
    return replaceFileManageService;
    }public void setreplaceFileManageService(IReplaceFileManageService replaceFileManageService) {
    this.replaceFileManageService = (IReplaceFileManageService) replaceFileManageService;
    }
    getreplaceFileManageService
    setreplaceFileManageService
    这里不对
      

  7.   

    public void setreplaceFileManageService(IReplaceFileManageService replaceFileManageService) {
    this.replaceFileManageService = (IReplaceFileManageService) replaceFileManageService;
    }把setreplaceFileManageService改为setReplaceFileManageService
      

  8.   


    不是名字的原因,系统突然有个spring的jar包报错,显示jar加载失败,我就忽略启动,重新加载jar包,然后就可以启动了
      

  9.   


    现在jar都一直显示错误:
    ultiple annotations found at this line:
    - cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'security-
     ext:user-service'.
    - schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/security/spring-security-
     ext-1.0.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document 
     is not <xsd:schema>.
    但是系统反而可以运行了,,