Struts2 log4j错误

时间:2018-02-21 11:00:25

标签: struts2 log4j slf4j

我将struts jar升级到2.5.10.1。但是我收到以下错误。最初,我有Log4J 2.5 jar,我将它迁移到Log4j 2.7。

SEVERE: Exception starting filter struts2
java.lang.NoSuchMethodError: java.util.Objects.requireNonNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
    at org.apache.logging.log4j.spi.LoggerRegistry.<init>(LoggerRegistry.java:96)
    at org.apache.logging.log4j.spi.LoggerRegistry.<init>(LoggerRegistry.java:92)
    at org.apache.logging.log4j.simple.SimpleLoggerContext.<init>(SimpleLoggerContext.java:67)
    at org.apache.logging.log4j.simple.SimpleLoggerContextFactory.<clinit>(SimpleLoggerContextFactory.java:29)
    at org.apache.logging.log4j.LogManager.<clinit>(LogManager.java:122)
    at org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter.<clinit>(StrutsPrepareAndExecuteFilter.java:51)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:531)
    at java.lang.Class.newInstance0(Class.java:372)
    at java.lang.Class.newInstance(Class.java:325)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:116)

以下是我在项目中使用的库。

antlr-2.7.6.jar
asm-3.3.jar
asm-commons-3.3.jar
asm-tree-3.3.jar
cglib-3.2.6.jar
commons-beanutils-1.8.0.jar
commons-collections-3.2.1.jar
commons-digester-1.8.jar
commons-email-1.2.jar
commons-fileupload-1.3.2.jar
commons-io-2.4.jar
commons-lang3-3.4.jar
commons-logging-4.0.6.jar
commons-validator-1.3.1.jar
dom4j-1.6.1.jar
freemarker-2.3.23.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate3.jar
javassist-3.20.0-GA.jar
json-lib-2.3-jdk15.jar
jta-1.1.jar
log4j-api-2.7.jar
log4j-slf4j-impl-2.7.jar
mail.jar
ognl-3.1.12.jar
poi-3.9.jar
slf4j-api-1.7.25 (1).jar
slf4j-log4j12-1.7.25.jar
sslext-1.2-0.jar
struts2-config-browser-plugin-2.5.10.1.jar
struts2-convention-plugin-2.5.10.1.jar
struts2-core-2.5.10.1.jar
struts2-jquery-chart-plugin-3.7.0.jar
struts2-jquery-grid-plugin-3.7.1.jar
struts2-jquery-plugin-3.7.1.jar
struts2-jquery-richtext-plugin-3.7.1.jar
struts2-json-plugin-2.5.10.1.jar
xwork-core-2.3.15.1.jar

我该如何解决这个问题?请指导我这个。感谢。

1 个答案:

答案 0 :(得分:0)

您应该从类路径中删除asm jar。

Struts 2.5.10.1的版本并不依赖于xwork-core 2.3.15。