This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | java.lang.NoClassDefFoundError: Could not initialize class org.apache.commons.logging.LogFactory | ||
---|---|---|---|
Product: | guibuilder | Reporter: | mclaborn <mclaborn> |
Component: | Code | Assignee: | issues@guibuilder <issues> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 7.0 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: |
Description
mclaborn
2011-06-22 20:09:17 UTC
Might be important that PanelSKUDisplay is not the class I was trying to open in the GUI editor. PanelSKUDisplay is a component that is used in the Panel that I was trying to open. I was able to reproduce problems with components that are using commons logging. Unfortunately, I was not able to obtain the same exception (i.e., NoClassDefFoundError). I got the following exception instead: java.lang.IllegalAccessError: tried to access class org.apache.commons.logging.LogFactory$6 from class org.apache.commons.logging.LogFactory at org.apache.commons.logging.LogFactory.getSystemProperty (LogFactory.java:1558) at org.apache.commons.logging.LogFactory.initDiagnostics(LogFactory.java:1575) at org.apache.commons.logging.LogFactory.<clinit>(LogFactory.java:1817) at javaapplication8.LogPanel.<clinit>(LogPanel.java:15) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:264) at org.netbeans.modules.form.project.ClassPathUtils.loadClass (ClassPathUtils.java:100) at org.netbeans.modules.form.MetaComponentCreator.prepareClass0 (MetaComponentCreator.java:1353) ... The root of the IllegalAccessError is the following: Classes for Commons Logging are loaded by system class loader because of bug 50642. Unfortunately, there are two versions of Commons Logging inside NetBeans IDE by now. There is a version 1.1 in o.apache.commons.logging and version 1.1.1 in html.validation. System class loader refuses to load LogFactory arbitrarily from one of these locations. Hence, GUI Builder's ProjectClassLoader is used instead. LogFactory$6 is new in version 1.1.1 of Commons Logging. Hence, the system class loader finds it in html.validation module only and loads it. Therefore, we end up with LogFactory$6 loaded by a different class loader than LogFactory and the result is the mentioned exception. I have modified the corresponding code to attempt to load Commons Logging classes from o.apache.commons.logging module only. Modified file: http://hg.netbeans.org/jet-main/rev/5bf995a5a3fb |