does not contain method named ‘xxx‘
Posted 蜜桃婷婷酱
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了does not contain method named ‘xxx‘相关的知识,希望对你有一定的参考价值。
2021-06-16 16:56:40 [ http-8080-2:538773 ] - [ ERROR ] Action[/KwmisAppCyfwXmSubj] does not contain method named ‘getSystemNotice’
java.lang.NoSuchMethodException: com.bb.kwmis.app.cyfw.web.action.KwmisAppCyfwXmSubjAction.getSystemNotice(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
顾名思义,上面错误提示actionzhong没有这个方法,但是我明明写了,为什么访问不到甚至报错
查阅了很多,总结一下给出几种解决方案
1.
既然是方法不匹配,既然方法名没有出那就是方法参数不匹配了
public ActionForward getSystemNotice(ActionMapping mapping,ActionForm form,
HttpServletResponse request,
HttpServletResponse response)throws Exception{
出错的原因是把第三个参数写成了HttpServletResponse类型,改成HttpServletRequest就行了。
网上说action的方法 要严格 ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response
我试了下参数位置对应好也没用
2.
该方法的权限是protected,改成public 。
3.
访问该方法的路径错误
正确写法:端口后面不跟项目名直接访问action下的方法
以上是关于does not contain method named ‘xxx‘的主要内容,如果未能解决你的问题,请参考以下文章
随记--'xxx' does not contain bitcode报错
Editor does not contain a main type问题
laravel --报错: Method varchar does not exist.
Mybatis_IllegalArgumentException: Mapped Statements collection does not contain value for
The ResourceConfig instance does not contain any root resource classes