You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Piotr Karwasz (Jira)" <ji...@apache.org> on 2022/10/27 22:20:00 UTC
[jira] [Commented] (LOG4J2-3624) NoClassDefFoundError initializing PropertiesUtil in Servlet 2.5 container
[ https://issues.apache.org/jira/browse/LOG4J2-3624?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17625348#comment-17625348 ]
Piotr Karwasz commented on LOG4J2-3624:
---------------------------------------
[~nsushkin@openfinance.com],
Don't you have the cause of the {{NoClassDefFoundError}} in your logs?
> NoClassDefFoundError initializing PropertiesUtil in Servlet 2.5 container
> -------------------------------------------------------------------------
>
> Key: LOG4J2-3624
> URL: https://issues.apache.org/jira/browse/LOG4J2-3624
> Project: Log4j 2
> Issue Type: Bug
> Components: API
> Affects Versions: 2.18.0
> Environment: Apache Tomcat/8.53
> Linux 4.14.1294-220.533.amzn2
> amd64
> JVM 1.8.0_3420-b07, Red Hat. Inc
>
> Reporter: Nicholas Sushkin
> Priority: Major
>
> The configuration I have in Tomcat 8 and Java 1.8 with the Servlet 2.5 style initialization works in 2.17.2, but breaks in 2.18.0 (and 2.19.0) with the following exception:
> {noformat}
> [localhost-startStop-1] Error configuring application listener of class org.apache.logging.log4j.web.Log4jServletContextListener
> java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.util.PropertiesUtil
> at org.apache.logging.log4j.status.StatusLogger.<clinit>(StatusLogger.java:78)
> at org.apache.logging.log4j.web.Log4jServletContextListener.<clinit>(Log4jServletContextListener.java:44)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> …
> at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4822)
> …
> {noformat}
> With log4j 2.17.2, there is no exception and {{Log4jServletFilter}} initializes fine.
> I traced class loading during the web application initialization.
> With 2.18.0, the following classes are loaded:
> * log4j.web.Log4jServletContainerInitializer log4j-web-2.18.0.jar
> * log4j.Logger log4j-api-2.18.0.jar
> * log4j.web.Log4jServletContextListener log4j-api-2.18.0.jar
> * log4j.web.Log4jWebSupport log4j-web-2.18.0.jar
> * log4j.core.LifeCycle log4j-core-2.18.0.jar
> * log4j.web.Log4jWebLifeCycle log4j-web-2.18.0.jar
> * com.ofc.data.server.MyBatisConfiguratingContextListener from classes
> * com.ofc.data.server.CleanupContextListener from classes
> * log4j.web.Log4jServletFilter log4j-web-2.18.0.jar
> * … other classes
> * log4j.spi.ExtendedLogger
> * log4j…
> * log4j.message.ParameterizedMessageFactory
> * log4j.util.Constants
> * log4j.util.PropertiesUtil
> * log4j.util.PropertySource
> * …
> * log4j.PropertySource$Comparator
> * log4j.util.BiConsumer
> * log4j.util.PropertiesUtil$Environment(Lambda)…
> * log4j.util.ServiceLoaderUtil
> * log4j.util.ServiceLoaderUtil.$ServiceLoaderSpliterator
> * java.util.ServiceConfigurationError
> !http://localhost:1313/ox-hugo/workspaces_EoJKh3w7hm_2022-10-27_15-56-03.png!
> With 2.17.2, it goes like this:
> * log4j.web.Log4jServletContainerInitializer log4j-web-2.17.2.jar
> * log4j.Logger log4j-api-2.17.2.jar
> * log4j.web.Log4jServletContextListener log4j-api-2.17.2.jar
> * log4j.web.Log4jWebSupport log4j-web-2.17.2.jar
> * log4j.core.LifeCycle log4j-core-2.17.2.jar
> * log4j.web.Log4jWebLifeCycle log4j-web-2.17.2.jar
> * com.ofc.data.server.MyBatisConfiguratingContextListener from classes
> * com.ofc.data.server.CleanupContextListener from classes
> * log4j.web.Log4jServletFilter log4j-web-2.17.2.jar
> * … other classes
> * org.apache.tomcat.jdbc.pool.Validator
> * log4j.spi.ExtendedLogger
> * log4j…
> * log4j.message.ParameterizedMessageFactory
> * log4j.util.Constants
> * log4j.util.PropertiesUtil
> * log4j.util.PropertySource
> * …
> * log4j.PropertySource$Comparator
> * log4j.util.BiConsumer
> * log4j.util.PropertiesUtil$Environment\(Lambda\)…
> * java.lang.invoke.LambdaForm$…
> * log4j.util.EnvironmentPropertySource
> * log4j.util.SystemPropertiesPropertySource
> * log4j.util.PropertiesUtil.$Environment$$Lambda
> !http://localhost:1313/ox-hugo/workspaces_vBkgFs3RKy_2022-10-27_15-50-13.png!
> In 2.8.0, log4j.util.PropertiesUtil.$Environment$$Lambda is loaded but not invoked.
> It looks like there are recent changes in log4j.util.PropertiesUtil.$Environment in commits aaf13561e7 Piotr Karwasz 2022-03-10, 262828b193 2022-04-13. These are changes for LOG4J2-3427.
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)