• Stacktraces java.lang.NoSuchMethodException: com.liuyang.action.UserAction.add()


    Struts Problem Report

    Struts has detected an unhandled exception:

    Messages:
    • com.liuyang.action.UserAction.add()
    File: java/lang/Class.java
    Line number: 1,678

    Stacktraces

    java.lang.NoSuchMethodException: com.liuyang.action.UserAction.add()
        java.lang.Class.getMethod(Class.java:1678)
        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.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)
        org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)
        org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)
        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
        org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        java.lang.Thread.run(Thread.java:745)

    发现有两种错误可能引起上述异常:

    (1)Action 类的方法被定义成 private 类型.

    如下 Action 中被访问的方法被定义成 private 类型.程序在访问其方法时,会抛出以上异常。(我的就是方法设置成了私有的)

    (2)Action类没有继承structs里面的DispatchAction或者其它的类

    java.lang.NoSuchMethodException这个异常的根本原因有两个:

    第一,缺少某些jar文件;

    第二,某些jar文件有重复。

     
  • 相关阅读:
    Java EE 和 Java Web
    09-盒模型
    08-层叠性权重相同处理
    07-css的继承性和层叠性
    06-伪元素选择器
    05-伪类选择器
    04-属性选择器
    03-高级选择器
    02-css的选择器
    01-css的引入方式
  • 原文地址:https://www.cnblogs.com/liuyangfirst/p/5969938.html
Copyright © 2020-2023  润新知