Hi Ernie, The classloader does support multi-release log4j jar file. https://issues.apache.org/jira/browse/NETBEANS-3679
--Christian On Sat, Feb 26, 2022 at 4:16 PM Ernie Rael <[email protected]> wrote: > Hi all, > > I'm looking at a problem between log4j and gui builder (not Matisse) for > someone. > NB13-rc3, jdk-17 (also fails with NB-12.2, jdk-15) > > The following trivial and tiny NB project runs fine (for example under > the debugger). > https://github.com/bpangburn/swingset/files/8146641/GuiFormTest.zip > > Comment out this line (log4j stuff) in the play.MyTextField constructor > and all is well. > final Logger logger = LogManager.getLogger(); > > One way to reproduce the problem (if it doesn't just happen). Open > NewJFrame.jav in the designer > ContextMenu: AddFromPalette > Beans > ChooseBean > enter: play.MyTextField > > Get the exception seen at the end of this message. Seems that log4j is > doing something weird that NB detects as a problem (security manager?). > > I took a quick look at CreationFactory.createDefaultInstance(Class) it > does a weird dance with classloaders (yes plural), but there's > CreationDescriptor cd = getDescriptor(cls); > ... > Object instance = cd != null ? > cd.createDefaultInstance() : > cls.newInstance(); > > And I was hoping there would be a way to get some BeanInfo thing (I > don't really know about BeanInfo's) as the CreationDescriptor but I > didn't find anything like that. And I don't really think that's the > problem. > > -ernie > > > This project was created with beanbinding plugin, but that's not > required to get the exception. > > INFO [org.netbeans.modules.form.MetaComponentCreator]: Failed to create > an instance of play.MyTextField class. > The class itself was loaded, but instantiating failed. > This typically happens due to an exception in constructor/initializer > code, or failure in loading an additional class needed by the component. > Check the attached exception. > java.lang.UnsupportedOperationException: No class provided, and an > appropriate one cannot be found. > at > org.apache.logging.log4j.LogManager.callerClass(LogManager.java:573) > at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:598) > at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:585) > at play.MyTextField.<init>(MyTextField.java:15) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > > Method) > at > > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) > at > > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at > > java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) > at > > java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128) > at > > java.base/jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347) > at java.base/java.lang.Class.newInstance(Class.java:645) > at > > org.netbeans.modules.form.CreationFactory.createDefaultInstance(CreationFactory.java:155) > at > > org.netbeans.modules.form.RADComponent.createBeanInstance(RADComponent.java:227) > at > org.netbeans.modules.form.RADComponent.initInstance(RADComponent.java:166) > > The above stack is consistent no matter how the exception is exactly > generated (RADComponent.initInstance) get called from multiple places. > > > --------------------------------------------------------------------- > 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 > > > >
