码迷,mamicode.com
首页 > 编程语言 > 详细

java.lang.NoSuchFieldError: VERSION_2_3_0 报错解决方案

时间:2016-05-06 19:23:02      阅读:1634      评论:0      收藏:0      [点我收藏+]

标签:

java.lang.NoSuchFieldError: VERSION_2_3_0
    at org.apache.struts2.views.freemarker.FreemarkerManager.createConfiguration(FreemarkerManager.java:331)
    at org.apache.struts2.views.freemarker.FreemarkerManager.init(FreemarkerManager.java:282)
    at org.apache.struts2.views.freemarker.FreemarkerManager.getConfiguration(FreemarkerManager.java:269)
    at org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.init(DefaultDispatcherErrorHandler.java:47)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:488)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)
好吧,今天公司主管看到一个新闻说除了struts 2.3.20.2,2.3.24.2,2.3.28.1几个版本外其他版本都不安全,因而
	对旧版进行升级,这个项目不是maven项目,要把jar包一个一个替换,但是不是简单换了jar包就行了,有些旧版特性新版不
	一定支持,新版兼容到的旧系统其他jar不一定支持,所以升级也是一个技术活啊。。。简单解决一个百度上好像都没人讨论
	过的一个版本问题,这个版本问题的解决方案是要替换freemarker的包到freemarker-2.3.23.jar,也就是最高版本,同时
	也提醒自己遇到问题一定不要慌,要根据出错提示分步进行解决.技术上的问题都是有办法解决的,要安静的思考一下解决方案.

struts2更新版本操作有关事项备注

struts2更新版本操作有关事项备注,

更新主要jar包:struts2-convention-plugin-version,struts2-core-version, struts2-spring-plugin-version  

依赖jar包:xwork-core-version

报错应更新有关jar包: freemarker-verson,log4j-version

mevan实例:


<!-- struts2 所有jar包 -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <!--<version>2.2.1</version>-->
            <version>2.3.24.1</version>
            <exclusions>
                <exclusion>
                    <groupId>com.sun</groupId>
                    <artifactId>tools</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <!--<version>2.2.1</version>-->
            <version>2.3.24.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
            <!--<version>2.2.1</version>-->
            <version>2.3.24.1</version>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>2.3.23</version>
        </dependency>

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>

          </dependency>

xwork-core-version此包不更新涉及报错:

  <filter>
       <filter-name>StrutsPrepareFilter</filter-name>
       <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
    </filter>
    <filter>
       <filter-name>StrutsExecuteFilter</filter-name>
       <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
    </filter>

此配置文件 类丢失错误

freemarker-verson,log4j-version 包不更新涉及报错:

 

java.lang.NoSuchFieldError: VERSION_2_3_0
    at org.apache.struts2.views.freemarker.FreemarkerManager.createConfiguration(FreemarkerManager.java:331)
    at org.apache.struts2.views.freemarker.FreemarkerManager.init(FreemarkerManager.java:282)
    at org.apache.struts2.views.freemarker.FreemarkerManager.getConfiguration(FreemarkerManager.java:269)
    at org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.init(DefaultDispatcherErrorHandler.java:47)
    at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:488)
    at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
    at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
    at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4746)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5399)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
    at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1114)
    at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1672)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:619)

 

 

 

 

java.lang.NoSuchFieldError: VERSION_2_3_0 报错解决方案

标签:

原文地址:http://www.cnblogs.com/lr393993507/p/5466476.html

(1)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!