java.lang.NoSuchFieldError:VERSION_2_3_0 位于 org.apache.struts2.views.freemarker.FreemarkerManager.createConfiguration(FreemarkerManager.java:316)

问题描述 投票:0回答:1

我刚刚将 Struts 2 版本升级到 2.5.2,并开始出现错误。我的应用程序甚至无法启动。我对

pom.xml
web.xml
进行了更改。我不确定我是否缺课,但日志没有这么说。

pom.xml
:

<properties>
    <struts.version.no>2.5.2</struts.version.no>
    <tiles.version.no>3.0.5</tiles.version.no>
</properties>
<dependency>
    <groupId>ognl</groupId>
    <artifactId>ognl</artifactId>
    <version>3.1.8</version>
</dependency>

web.xml
:

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>
        org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
</filter>

日志错误:

Sep 06, 2016 9:07:12 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_75\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre1.8.0_66/bin/client;C:/Program Files (x86)/Java/jre1.8.0_66/bin;C:/Program Files (x86)/Java/jre1.8.0_66/lib/i386;C:\Program Files (x86)\IBM\RationalSDLC\common;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Enterprise Vault\EVClient\;C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\bin;C:\Dev\apache-maven-3.2.3-bin\apache-maven-3.2.3\bin;C:\Dev\apache-maven-3.2.3-bin\apache-maven-3.2.3\bin;C:\Program Files\Java\jdk1.7.0_75\bin;;C:\Dev\sts-3.6.1.RELEASE;;.
Sep 06, 2016 9:07:12 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ESignatureUIWAR' did not find a matching property.
Sep 06, 2016 9:07:12 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Sep 06, 2016 9:07:12 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Sep 06, 2016 9:07:12 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 697 ms
Sep 06, 2016 9:07:12 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Sep 06, 2016 9:07:12 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.47
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Sep 06, 2016 9:07:21 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Sep 06, 2016 9:07:29 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.NoSuchFieldError: VERSION_2_3_0
at org.apache.struts2.views.freemarker.FreemarkerManager.createConfiguration(FreemarkerManager.java:316)
at org.apache.struts2.views.freemarker.FreemarkerManager.init(FreemarkerManager.java:263)
at org.apache.struts2.views.freemarker.FreemarkerManager.getConfiguration(FreemarkerManager.java:252)
at org.apache.struts2.dispatcher.DefaultDispatcherErrorHandler.init(DefaultDispatcherErrorHandler.java:48)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:487)
at org.apache.struts2.dispatcher.InitOperations.initDispatcher(InitOperations.java:75)
at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:63)
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:4775)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Sep 06, 2016 9:07:29 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
Sep 06, 2016 9:07:29 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/ESignatureUIWARv1] startup failed due to previous errors
Sep 06, 2016 9:07:29 AM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
WARN: The method class org.apache.commons.logging.impl.SLF4JLogFactory#release() was invoked.
WARN: Please see http://www.slf4j.org/codes.html#release for an explanation.
Sep 06, 2016 9:07:29 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/ESignatureUIWARv1] appears to have started a thread named [EvictionTimer-0] but has failed to stop it. This is very likely to create a memory leak.
Sep 06, 2016 9:07:29 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/ESignatureUIWARv1] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@bc8a97d]) and a value of type [com.opensymphony.xwork2.inject.ContainerImpl] (value [com.opensymphony.xwork2.inject.ContainerImpl@22ef5396]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Sep 06, 2016 9:07:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Sep 06, 2016 9:07:29 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Sep 06, 2016 9:07:29 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 16817 ms
java maven struts2 freemarker
1个回答
3
投票

您遇到版本不匹配错误。根据http://mvnrepository.com/artifact/org.apache.struts/struts2-core/2.5.2

,freemarker库的版本应该是2.3.23

我的依赖插件显示

[INFO] +- org.apache.struts:struts2-core:jar:2.5.2:compile
[INFO] |  +- org.freemarker:freemarker:jar:2.3.25-incubating:compile

它们都定义了

Configuration.VERSION_2_3_0

© www.soinside.com 2019 - 2024. All rights reserved.