Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-3679

NetBeans plugin classloader does not work with multi-release JARs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 11.2
    • None
    • core
    • None

    Description

      I have a plugin which uses Apache Log4J 2, which has the following (nice) API to request a Logger from the LogManager:

      private static final Logger LOGGER = LogManager.getLogger();
      

      Unfortunately, running NetBeans 11.2 on Java 13 causes the plugin to fail, with an ExceptionInInitializerError:

      Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
      at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:555)
      at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:580)
      at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:567)
      

      AFAICT, the reason is the same as for a similar bug I recently reported in IntelliJ: NetBeans plugin classloader cannot handle multi-release JARs as per JEP 238, which is exactly what Log4J's StackLocatorUtil.getCallerClass needs to work on both Java 8 and 9 or newer (a more detailed analysis in the IntelliJ bug).

      The effect of this limitation is that your NetBeans plugins cannot depend on any multi-release JARs like Log4J.

      Attachments

        Activity

          People

            Unassigned Unassigned
            asewe Andreas Sewe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: