Struts2 2.3升级2.5.22版本遇到的问题

本文档详细记录了从Struts2.3到2.5版本的升级过程,包括必要的jar包更新,如struts2-dojo-plugin、struts2-core等,并解决了升级过程中遇到的一系列问题,如NoClassDefFoundError、本地与服务器表现不一致、方法调用限制等。

jdk 1.7
升级jar包
asm-7.0.jar
asm-commons-7.0.jar
asm-tree-7.0.jar
commons-fileupload-1.3.3.jar
commons-io-2.5.jar
commons-lang3-3.6.jar
commons-logging-1.1.3.jar
freemarker-2.3.23-incubating.jar
javassist-3.23.0-GA.jar
log4j-api-2.12.1.jar
log4j-core-2.12.1.jar
ognl-3.1.15.jar
struts2-config-browser-plugin-2.5.22.jar
struts2-convention-plugin-2.5.22.jar
struts2-core-2.5.22.jar
struts2-dojo-plugin-2…3.28.jar
struts2-json-plugin-2.5.22.jar
struts2-junit-plugin-2.5.22.jar
struts2-spring-plugin-2.5.22.jar

准备

struts2-config-browser-plugin 可以看到所有action 用法:http://ip:port/projectName/config-browser/actionNames.action
http://loaclhost:7001/项目名称/config-browser/actionNames.action

web.xml : <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
</filter-class>

struts2.xml 2.3–>2.5

其他:https://cwiki.apache.org/confluence/display/WW/Version+Notes+2.5.22

遇到问题
1:
2:
3:加入 struts2-dojo-plugin-2.3.15.1 后 报错
Caused by: java.lang.NoClassDefFoundError: org/apache/struts2/views/TagLibrary

解决:
升级 struts2-dojo-plugin-2.3.28包

4:报错:14:09:58.637 [[ACTIVE] ExecuteThread: ‘0’ for queue: ‘weblogic.kernel.Default (self-tuning)’] ERROR org.apache.struts2.convention.DefaultClassFinder - Unable to read class [com.server.action.******Action]
java.lang.IllegalArgumentException: null
at org.objectweb.asm.ClassVisitor.(Unknown Source) ~[asm-5.2.jar:5.2]
at org.objectweb.asm.ClassVisitor.(Unknown Source) ~[asm-5.2.jar:5.2] …

asm  asm-commons  asm-tree 版本升级到7.0

5:本地未报错 ,放到服务器上
Incorrectly typed data found for annotation element public abstract java.lang.String[] org.apache.struts2.convention.annotation.Result.name() (Found data of type class java.lang.String[***])
在这里插入图片描述
解决: name 为String[] 将之前的 (name=“expAll”) 修改为 (name={“expAll”}) 后,启动正常
在这里插入图片描述
6.报错 :There is no Action mapped for namespace [/] and action name [***!***] associated with context path [/******]
解决:struts 加入:<constant name=“struts.enable.DynamicMethodInvocation” value=“true”/>

7.报错 :Method tests for action json is not allowed
解决:2.5安全性 用的注解@AllowedMethods({“regex:.*”})

struts.xml:<global-allowed-methods>regex:.*</global-allowed-methods>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值