警告: couldn't clear tomcat cache
最近在项目中实现一个文件传输功能时,每完成一次操作tomcat8中总是抛出如下异常:
警告: couldn't clear tomcat cache java.lang.NoSuchFieldException: resourceEntries at java.lang.Class.getDeclaredField(Unknown Source) at com.opensymphony.xwork2.util.LocalizedTextUtil.clearMap(LocalizedTextUtil.java:735) at com.opensymphony.xwork2.util.LocalizedTextUtil.clearTomcatCache(LocalizedTextUtil.java:719) at com.opensymphony.xwork2.util.LocalizedTextUtil.reloadBundles(LocalizedTextUtil.java:703) at com.opensymphony.xwork2.util.LocalizedTextUtil.findDefaultText(LocalizedTextUtil.java:178) at com.opensymphony.xwork2.util.LocalizedTextUtil.getDefaultMessage(LocalizedTextUtil.java:579) at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:461) at com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:293) at org.apache.struts2.interceptor.FileUploadInterceptor.getTextMessage(FileUploadInterceptor.java:368) at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:277) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221) at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224) at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
虽然不影响使用,but maybe it is a time bomb! 于是决定找出原因。搜索了一番,发现解决方案大概有两种:
方案一:
因为tomcat8没有属性resourceEntries,换成tomcat7就好了。但是从tomcat8==>tomcat7感觉在退步,果断拒绝此方法。
参考链接:http://blog.csdn.net/findbestoy/article/details/50756465
方案二:
升级struts版本,struts2.0.9==>struts2.3.20,完美解决问题,坚决采纳本方法!
struts2.3.20下载地址:http://download.csdn.net/detail/xyznad/9486393
参考链接:http://blog.csdn.net/bigtree_3721/article/details/50866958