Andreas Sewe created NETBEANS-3679:
--------------------------------------
Summary: NetBeans plugin classloader does not work with
multi-release JARs
Key: NETBEANS-3679
URL: https://issues.apache.org/jira/browse/NETBEANS-3679
Project: NetBeans
Issue Type: Bug
Components: core
Affects Versions: 11.2
Reporter: Andreas Sewe
I have a plugin which uses Apache Log4J 2, which has the following (nice) API
to request a {{Logger}} from the {{LogManager}}:
{code:java}
private static final Logger LOGGER = LogManager.getLogger();
{code}
Unfortunately, running NetBeans 11.2 on Java 13 causes the plugin to fail, with
an {{ExceptionInInitializerError}}:
{noformat}
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)
{noformat}
AFAICT, the reason is the same as for a [similar bug I recently reported in
IntelliJ|https://youtrack.jetbrains.com/issue/IDEA-220300]: NetBeans plugin
classloader cannot handle multi-release JARs as per [JEP
238|https://openjdk.java.net/jeps/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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists