Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
11.2
-
None
-
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.