2

I'm creating a basic Struts2 webApp and getting this error when I deploy to Tomcat 10. Has anyone seen this?

How can I solve this?

java.lang.NoSuchMethodError: 'java.lang.String org.apache.logging.log4j.util.PropertiesUtil.getStringProperty(java.lang.String[], java.lang.String, org.apache.logging.log4j.util.Supplier)'
    at org.apache.logging.log4j.core.util.BasicAuthorizationProvider.<init>(BasicAuthorizationProvider.java:43)
    at org.apache.logging.log4j.core.config.ConfigurationFactory.authorizationProvider(ConfigurationFactory.java:215)
    at org.apache.logging.log4j.core.config.ConfigurationFactory.getInstance(ConfigurationFactory.java:188)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:696)
    at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:717)
    at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:272)
    at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)

web.xml & struct.xml

<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:javaee="http://java.sun.com/xml/ns/javaee"
         xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
          http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         id="WebApp_ID" version="2.5">
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.5//EN"
"http://struts.apache.org/dtds/struts-2.5.dtd">

<struts>
    <package name="default" extends="struts-default">
        <action name="myurl" class="com.pro.basics.myActionClass">
            <result name="success">/success.jsp</result>
        </action>
    </package>
</struts>
3
  • 1
    Which log4j version are you using? Commented Jul 30, 2021 at 13:00
  • log4j-api-2.12.1 and log4j-core-2.14.1 Commented Jul 30, 2021 at 13:17
  • 1
    You need to use the exact same version of those artifacts. Commented Jul 30, 2021 at 13:19

1 Answer 1

4

Use the same versions of log4j-api and log4j-core

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.