Struts2 无法找到Action

郁闷死了,为什么我所有的action都抱着个异常?无语。。。
[code="java"]
java.lang.NoSuchMethodException: $Proxy20.searchPlacePos()
java.lang.Class.getMethod(Class.java:1605)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.getActionMethod(AnnotationValidationInterceptor.java:75)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:47)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:179)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:94)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:130)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:165)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:179)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:237)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)

[/code]
Struts-map.xml
[code="java"]<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">



/map/searchPlace.jsp


/map/editPlace.jsp


/map/searchPlace.jsp
getMapList.action


getMapList.action

    <action name="searchAreas" class="ktMapAction" method="searchArea">
        <result name="success">/map/searchArea.jsp</result>
    </action>
    <action name="editArea" class="ktMapAction" method="editArea">
        <result name="success">/map/editArea.jsp</result>
    </action>
    <action name="saveArea" class="ktMapAction" method="saveArea">
        <result name="input">/map/editArea.jsp</result>
        <result name="success" type="redirectAction">getMapList.action</result>
    </action>
    <action name="removeArea" class="ktMapAction" method="removeArea">
        <result name="success" type="redirectAction">getMapList.action</result>
    </action>

    <action name="searchPlacePosss" class="ktMapAction" method="searchPlacePos">
        <result name="success">/map/searchPlacePos.jsp</result>
    </action>
    <action name="editPlacePos" class="ktMapAction" method="editPlacePos">
        <result name="success">/map/editPlacePos.jsp</result>
    </action>
    <action name="savePlacePos" class="ktMapAction" method="savePlacePos">
        <result name="input">/map/editPlacePos.jsp</result>
        <result name="success" type="redirectAction">getMapList.action</result>
    </action>
    <action name="removePlacePos" class="ktMapAction" method="removePlacePos">
        <result name="success" type="redirectAction">getMapList.action</result>
    </action>
</package>

[/code]
Action里面也有这个无参方法。。。
[code="java"]
public String searchPlacePos() {
placePosList = placePosManager.getAll();
return SUCCESS;
}[code]

访问的url:http://localhost:8080/ge/npc/searchPlacePos.action
按理说,这个异常是struts拦截到了不然会报404的
web.xml
[code="java"]
struts2
org.apache.struts2.dispatcher.FilterDispatcher


struts2
*.action
REQUEST
FORWARD

[/code]

6个回答

那就看看:

1、struts-spring-plugin.jar是否加入?

2、web.xml中Spring的Listener是否配置?

3、spring的其他配置?

extends="struts-default",改一下看看还报错吗?

你前面有自定义的拦截器,被拦截了,你放行了之后,他的后面是不是还要走一下Struts自带的默认的拦截器呢?你就没有从那里走,他怎么去找你的Action,在自定义拦截器之后再去调用一下默认的拦截器,就行了

Spring插件的配置如何??

你请求的url和你配置的package的命名空间好象不一致啊,检查一下是不是这个原因

[code="java"]

/map/searchPlacePos.jsp

[/code]

[b]你的Action的name属性错误: searchPlacePosss 多了2个ss[/b]

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问