struts2.3.15 注解注入

axel11 发布于 2013/07/17 15:13
阅读 2K+
收藏 0
  为了解决struts2的安全漏洞,要求提升struts版本,我将struts版本从2.1.6升级到2.3.15后原先action代码中的注解注入的action方法都无法正常被解析出来,有哪位大神升级过2.3.15的能帮忙看一下吗。

这个是目前的配置和代码:

struts.properties

struts.xml

class文件

出现错误:

Struts Problem Report

Struts has detected an unhandled exception:

Messages:
  • com.club.website.action.TestAction.index()
  • File: java/lang/Class.java
    Line number: 1,605

    Stacktraces

    java.lang.NoSuchMethodException: com.club.website.action.TestAction.index()
    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:98)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
        com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
        com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
        org.apache.struts2.rest.RestActionInvocation.invoke(RestActionInvocation.java:138)
        com.opensymphony.xwork2.DefaultActionProxy.execute(DefaultActionProxy.java:147)
        org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
        org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
        org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        com.club.interceptor.EncodingFilter.doFilter(EncodingFilter.java:181)
        org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:470)
        org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
        org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
        org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        java.lang.Thread.run(Thread.java:619)
    请求哪位遇到过这个问题的大神帮忙看看
    加载中
    0
    pantrick
    pantrick
    action定义呢,而且你的插件也同时得更新
    0
    a
    axel11

    刚才漏贴代码了

    所有相关的jar包都更新了

    0
    红叔
    红叔
    同问,我也碰到相同的问题了...
    0
    Dead_knight
    Dead_knight

    升级struts2本身的lib包同时,还需要使用asm的三个包,分别在struts2.3.15目录的lib文件夹下

    0
    liuNico
    liuNico

    折腾的答案,亲测解决该问题。

    <!-- 非jboss 必须设置为false -->

    <constant name="struts.convention.exclude.parentClassLoader" value="false" />
    返回顶部
    顶部