最近在周围的有个朋友在项目开发中遇到了一个问题,启动项目时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)

有时候虽然不是很影响使用,但是看着总是感觉不爽。自己在网上也搜索一番,发现解决方案大概有两种:

方案一:

因为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

标签: Struts2启动时异常, 警告: couldn't clear tomcat cache, java.lang.NoSuchFieldException: resourceEntries

添加新评论