Log4j 2
  1. Log4j 2
  2. LOG4J2-587

log4j-1.2-api emulation jar missing classes

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-rc1
    • Fix Version/s: None
    • Component/s: log4j 1.2 emulation
    • Labels:

      Description

      The log4j 1.2 emulation jar does not contain AppenderSkeleton. There are several Spring components like spring-amqp that define custom appenders.

      Even if you don't reference those appenders because of various class loading discovery (such as Springs annotation configuration) you will get exceptions like

      java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
      	at java.lang.Class.getDeclaredMethods0(Native Method)
      	at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
      	at java.lang.Class.getDeclaredMethods(Class.java:1855)
      	at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(
      

      And thus you cannot remove the original log4j-1.2.x jars.

      Basically the class just needs to exist to avoid reflection exceptions like the one above. Unfortunately this is a show stopper for us as we use Spring heavily and and it appears to happen on any of our spring applications and we don't allow jars with duplicate classes in our projets.

      This appears to be an easy fix... just stub all of the log4j-1.2 classes that are extendable.

      The log4j SLF4J bridge does in fact contain the appender skeleton: http://www.slf4j.org/api/org/apache/log4j/package-summary.html

      Consequently a not so ideal workaround is to just use log4j-over-slf4j.jar which does contain the AppenderSkeleton.

        Activity

        Adam Gent created issue -
        Adam Gent made changes -
        Field Original Value New Value
        Description The log4j 1.2 emulation jar does not contain {{AppenderSkeleton}}. There are several Spring components like spring-amqp that define custom appenders.

        Even if you don't reference those appenders because of various class loading discovery (such as Springs annotation configuration) you will get exceptions like

        {code}
        java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
        at java.lang.Class.getDeclaredMethods(Class.java:1855)
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(
        {code}

        And thus you cannot remove the original log4j-1.2.x jars.

        Basically the class just needs to exist to avoid reflection exceptions like the one above. Unfortunately this is a show stopper for us as we use Spring heavily and and it appears to happen on any of our spring applications and we don't allow jars with duplicate classes in our projets.

        This appears to be an easy fix... just stub all of the log4j-1.2 classes that are extendable.
        The log4j 1.2 emulation jar does not contain {{AppenderSkeleton}}. There are several Spring components like spring-amqp that define custom appenders.

        Even if you don't reference those appenders because of various class loading discovery (such as Springs annotation configuration) you will get exceptions like

        {code}
        java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
        at java.lang.Class.getDeclaredMethods(Class.java:1855)
        at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.findPersistenceMetadata(
        {code}

        And thus you cannot remove the original log4j-1.2.x jars.

        Basically the class just needs to exist to avoid reflection exceptions like the one above. Unfortunately this is a show stopper for us as we use Spring heavily and and it appears to happen on any of our spring applications and we don't allow jars with duplicate classes in our projets.

        This appears to be an easy fix... just stub all of the log4j-1.2 classes that are extendable.

        The log4j SLF4J bridge does in fact contain the appender skeleton: http://www.slf4j.org/api/org/apache/log4j/package-summary.html

        Consequently a not so ideal workaround is to just use {{log4j-over-slf4j.jar}} which does contain the AppenderSkeleton.
        Adam Gent made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Adam Gent
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development