Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-6385

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.0, 4.2.7
    • Component/s: karaf
    • Labels:
      None
    • Environment:

      Karaf 4.3.0 + Java 11

      Description

      I've tried using Karaf 4.3.0 built from sources (to fix another issue) and on Java 11 now am always getting following message in console: 

      WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
      

      It appears it comes from log4j (specifically this line) and is raised because on Java 11 reflection from Java8 does not work and "org.ops4j.pax.logging" does not include java9-compatible classes most probably because of this issue.

      This message does not appear in Karaf 4.2.6 and after some debugging I see this is happening because in 4.2.6 version of "org.ops4j.pax.logging" is 1.10.2 and code goes through this line:
      getServices() returns null and therefore event.getLocationInformation() is not invoked

          public void doAppend( PaxLoggingEvent event )
          {
              if (count != getTrackingCount()) {
                  count = getTrackingCount();
                  appenders = getServices();
              }
              if (appenders != null && appenders.length > 0) {
                  // Bug in Karaf, as it expects the source to be available
                  event.getLocationInformation();
                  for (Object appender : appenders) {
                      ((PaxAppender) appender).doAppend(event);
                  }
              }
          }
      

      In "org.ops4j.pax.logging" v1.11.0 (included in 4.3.0) code goes through this line:
      because getServices(<empty array>) returns that same empty array, code falls into 'if' with that empty array and event.getLocationInformation(); is called (what throws the subject WARNING), whereas its output is not used because list of appenders is empty - no event.getLocationInformation() == no WARNING

              @Override
          public void doAppend(PaxLoggingEvent event) {
              if (count != getTrackingCount()) {
                  count = getTrackingCount();
                  appenders = getServices(new PaxAppender[0]);
              }
              if (appenders != null) {
                  // Bug in Karaf, as it expects the source to be available
                  event.getLocationInformation();
                  for (PaxAppender appender : appenders) {
                      appender.doAppend(event);
                  }
              }
          }
      

      So ... it seems it is bug in "org.ops4j.pax.logging" v1.11.0 and it is to early to include it into Karaf.

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbonofre Jean-Baptiste Onofré
                Reporter:
                xtracoder Xtra Coder
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: