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.

Bug 177151

Summary: [68cat] NoClassDefFoundError: Could not initialize class org.netbeans.modules.profiler.actions.SelfSamplerAction
Product: platform Reporter: Exceptions Reporter <exceptions_reporter>
Component: Module SystemAssignee: Jesse Glick <jglick>
Status: RESOLVED INCOMPLETE    
Severity: normal CC: jtulach
Priority: P3 Keywords: ERGONOMICS
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 160088
Attachments: stacktrace

Description Exceptions Reporter 2009-11-18 19:59:19 UTC
Build: NetBeans IDE Dev (Build 200910100201)
VM: Java HotSpot(TM) Client VM, 1.6.0_03-b05, Java(TM) SE Runtime Environment, 1.6.0_03-b05
OS: Windows XP, 5.1, x86

User Comments:
GUEST: help !!!!

john_hopper: starting up the IDE

GUEST: A java.lang.ClassNotFoundException exception has occurred.
However, the system should continue working without further problems.
Click Show Details for the stack trace.

dexter8830: A java.lang.ClassNotFoundException exception has occurred.
However, the system should continue working without further problems.
Click Show Details for the stack trace.



Stacktrace: 
java.lang.NoClassDefFoundError: Could not initialize class org.netbeans.modules.profiler.actions.SelfSamplerAction
        at java.lang.Class.forName0(Class.java:0)
        at java.lang.Class.forName(Class.java:247)
        at org.netbeans.core.startup.layers.BinaryFS$AttrImpl.findClass(BinaryFS.java:678)
        at org.netbeans.core.startup.layers.BinaryFS$AttrImpl.methodValue(BinaryFS.java:618)
        at org.netbeans.core.startup.layers.BinaryFS$AttrImpl.getValue(BinaryFS.java:536)
        at org.netbeans.core.startup.layers.BinaryFS$BFSBase.getAttribute(BinaryFS.java:382)
Comment 1 Exceptions Reporter 2009-11-18 19:59:22 UTC
Created attachment 91302 [details]
stacktrace
Comment 2 Jesse Glick 2009-11-19 09:14:36 UTC
Seems to be some problem between ergonomics, profiler, and exception reporter?
Comment 3 Jaroslav Tulach 2009-11-30 05:50:30 UTC
According to following log:
http://statistics.netbeans.org/exceptions/messageslog?id=303673
the profiler module is being enabled and is enabled at the end. However before that happens, the system finds file on disk referencing SelfSamplerAction and tried to instantiate it (which fails).

I attribute this to the fact that platform first changes layers and only then updates system classloader. Reassigning to platform to first of all setup classloaders and only then update filesystems.
Comment 4 Jesse Glick 2009-11-30 10:43:35 UTC
The module system already does set up the system class loader before loading layers. Anyway the problem does not appear to be that SelfSamplerAction cannot be found in the system class loader (which would produce a simpler CNFE), but that it cannot be initialized:

NoClassDefFoundError: Could not initialize class org.netbeans.modules.profiler.actions.SelfSamplerAction
	at java.lang.Class.forName0(Native Method)

However this is not an ExceptionInInitializerError, nor is there any nested cause. In my experiments, the NCDFE means that was earlier an EIIE thrown:

package ncdfe;
public class Main {
    public static void main(String[] args) {
        try {
            System.out.println(Class.forName("ncdfe.Main$X"));
        } catch (Throwable t) {
            t.printStackTrace();
        }
        try {
            System.out.println(Class.forName("ncdfe.Main$X"));
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
    public static class X {
        static {
            if (X.class != null) {
                throw new NullPointerException("oops!");
            }
        }
    }
}

=>

java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at ncdfe.Main.main(Main.java:5)
Caused by: java.lang.NullPointerException: oops!
        at ncdfe.Main$X.<clinit>(Main.java:18)
        ... 3 more
java.lang.NoClassDefFoundError: Could not initialize class ncdfe.Main$X
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at ncdfe.Main.main(Main.java:10)

So this implies that something, somewhere, is catching and swallowing an EIIE caused by some problem in SelfSamplerAction.java's static initializers (which seem to call just NbBundle.getMessage and Logger.getLogger).

I can try to make BinaryFS report EIIE's the same as NCDFE's and hope that this will cause the real problem to be reported: core-main #da1deaddae5c
Comment 5 Quality Engineering 2009-12-01 03:05:48 UTC
Integrated into 'main-golden', will be available in build *200912010200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/da1deaddae5c
User: Jesse Glick <jglick@netbeans.org>
Log: #177151: catch any LinkageError, not just NoClassDefFoundError.