Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-25860

Fix log4j-api classpath conflict between Tomcat and Application classpaths

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.3

      Description

      Since NXP-23863, we have issue on wizard tests.
      Tomcat stopped when running the packed war:

      2018-09-28 09:50:23.970 SEVERE [main] org.apache.catalina.core.StandardContext.loadOnStartup Servlet [nuxeo-wizard] in web application [/nuxeo] threw load() exception
       java.lang.NoClassDefFoundError: Could not initialize class org.apache.logging.log4j.status.StatusLogger
      	at org.apache.logging.log4j.core.AbstractLifeCycle.<clinit>(AbstractLifeCycle.java:38)
      	at org.nuxeo.launcher.config.ConfigurationGenerator.<init>(ConfigurationGenerator.java:434)
      	at org.nuxeo.launcher.config.ConfigurationGenerator.<init>(ConfigurationGenerator.java:344)
      	at org.nuxeo.wizard.nav.SimpleNavigationHandler.<init>(SimpleNavigationHandler.java:87)
      	at org.nuxeo.wizard.nav.SimpleNavigationHandler.instance(SimpleNavigationHandler.java:58)
      	at org.nuxeo.wizard.RouterServlet.<init>(RouterServlet.java:95)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
      

      This is because log4j-api has scope compile on nuxeo-ecm, so it will be packed as library during war build.
      This is problematic because this artifact hides the one present in TOMCAT_HOME/lib.
      log4j-core needs log4j-api, but it won't find api classes when it will try to load them because log4j-api is present in application classpath and not in the tomcat one.

      Solution is to change scope of log4j-api to provided.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day
                  1d