NoClassDefFoundError: com/sun/java/accessibility/util/SwingEventMonitor

Pete Brunet peter.brunet at oracle.com
Wed Aug 4 04:12:29 UTC 2010


The failure is on this line of code:
AWTEventMonitor.addFocusListener(this)
which resides in ...\classes\sun\awt\windows\accessibility

AWTEventMonitor is a class in jaccess-1_4.jar which is in lib/ext

However, just before the failing line is executed, a println shows these
two system properties
java.ext.dir: null
java.class.path: \Program
Files\Java\jdk1.6.0_20\demo\jfc\SwingSet2\SwingSet2.jar

so that seems to explain why a class in a jar in lib/ext won't be found
(unless there is some other internal means being used to find jar files).

Since I suspect I'll eventually merge this package into the jdk, to
continue debugging I extracted the jar into the classes directory.

Pete
===
Pete Brunet wrote:
> The class loading info wasn't helpful.  If I run jdb I get the log shown
> below.  So far the debug info isn't making sense.  Hopefully it will
> tomorrow :-)  If someone can decipher this from the log that would be
> helpful. 
>
> Exception occurred: java.lang.NoClassDefFoundError (to be caught at:
> com.sun.java.accessibility.util.EventQueueMonitor.addTopLevelWindow(),
> line=279 bci=119)"thread=AWT-EventQueue-0",
> sun.awt.windows.accessibility.AccessibleContextMirror.<init>(), line=584
> bci=766
>
> Also, do I need to change my build in order to use jdb?  One source
> indicated I need to use a -g option at compile time.  Perhaps this is
> why the jdb threads output doesn't show thread IDs.
>
> Thanks, Pete
>
> === log of debug session ===
> C:\SwingSet2>c:\OpenJDK-b96m\jdk7\build\windows-i586-fastdebug\bin\jdb
> SwingSet2
>
> java.util.ServiceConfigurationError: com.sun.jdi.connect.Connector:
> Provider sun.jvm.hotspot.jdi.SACoreAttachingConnector not found
> java.util.ServiceConfigurationError: com.sun.jdi.connect.Connector:
> Provider sun.jvm.hotspot.jdi.SADebugServerAttachingConnector not found
> java.util.ServiceConfigurationError: com.sun.jdi.connect.Connector:
> Provider sun.jvm.hotspot.jdi.SAPIDAttachingConnector not found
> Initializing jdb ...
>   
>> stop at sun.awt.windows.accessibility.AccessibleContextMirror:584
>>     
> Deferring breakpoint
> sun.awt.windows.accessibility.AccessibleContextMirror:584.
> It will be set after the class is loaded.
>   
>> run
>>     
> run SwingSet2
> Set uncaught java.lang.Throwable
> Set deferred uncaught java.lang.Throwable
>   
> VM Started:
>
> wins.length = 1
>
> Set deferred breakpoint
> sun.awt.windows.accessibility.AccessibleContextMirror:584
>
> Breakpoint hit: "thread=AWT-EventQueue-0",
> sun.awt.windows.accessibility.AccessibleContextMirror.<init>(), line=584
> bci=765
>
> AWT-EventQueue-0[1] catch java.lang.NoClassDefFoundError
> Deferring all java.lang.NoClassDefFoundError.
> It will be set after the class is loaded.
> AWT-EventQueue-0[1] step
>   
>> Set deferred all java.lang.NoClassDefFoundError
>>     
>
> Exception occurred: java.lang.NoClassDefFoundError (to be caught at:
> com.sun.java.accessibility.util.EventQueueMonitor.addTopLevelWindow(),
> line=279 bci=119)"thread=AWT-EventQueue-0",
> sun.awt.windows.accessibility.AccessibleContextMirror.<init>(), line=584
> bci=766
>
> AWT-EventQueue-0[1] threads
> Group system:
>   (java.lang.ref.Reference$ReferenceHandler)0x122                  
> Reference Handler                      cond. waiting
>   (java.lang.ref.Finalizer$FinalizerThread)0x121                   
> Finalizer                           cond. waiting
>   (java.lang.Thread)0x120                                          
> Signal Dispatcher                      running
>   (java.lang.Thread)0x11f                                          
> Attach Listener                        running
>   (java.lang.Thread)0x252                                          
> Java2D Disposer                        cond. waiting
>   (java.lang.Thread)0x59e                                          
> TimerQueue                           cond. waiting
> Group main:
>   (java.lang.Thread)0x255                                          
> AWT-Shutdown                           cond. waiting
>   (java.lang.Thread)0x256                                          
> AWT-Windows                           running
>   (com.sun.java.accessibility.util.ComponentEvtDispatchThread)0x26a
> EventQueueMonitor-ComponentEvtDispatch cond. waiting
>   (java.awt.EventDispatchThread)0x3bc                              
> AWT-EventQueue-0                       running
>   (SwingSet2$DemoLoadThread)0x691                                  
> Thread-1                           running
>   (java.lang.Thread)0x692                                          
> DestroyJavaVM                          running
>
> === end log of debug session ===
>
> === code for addTopLevelWindow ===
>
>     static boolean addTopLevelWindow(Component c) {
>         Container parent;
>
>         if (c == null) {
>             return false;
>         }
>
>         if (!(c instanceof Window)) {
>             return addTopLevelWindow(c.getParent());
>         }
>
>         if ((c instanceof Dialog) || (c instanceof Window)) {
>             parent = (Container) c;
>         } else {
>             parent = c.getParent();
>             if (parent != null) {
>                 return addTopLevelWindow(parent);
>             }
>         }
>
>         if (parent == null) {
>             parent = (Container) c;
>         }
>
>         // Because this method is static, do not make it synchronized
> because
>         // it can lock the whole class.  Instead, just lock what needs to be
>         // locked.
>         //
>         synchronized (topLevelWindows) {
>             if ((parent != null) && !topLevelWindows.contains(parent)) {
>                 topLevelWindows.addElement(parent);
>                 if (topLevelWindowListener != null) {
>                    
> topLevelWindowListener.topLevelWindowCreated((Window) parent);
>                 }
>                 return true;
>             } else {
>                 return false;
>             }
>         }  <----- this is line 279 (if I have the correct source file)
>     }
>
> === end of code for addTopLevelWindow ===
>
> David Holmes wrote:
>   
>> You add it in conjunction with the -XX:+TraceClassLoading.
>>
>> David
>>
>> Pete Brunet said the following on 08/03/10 10:15:
>>     
>>> Hi David, I didn't get any output at all from that one - though it
>>> appears to be a valid parameter as it didn't result in an error
>>> message.  -Pete
>>>
>>> David Holmes wrote:
>>>       
>>>> Peter,
>>>>
>>>> Try adding -XX:+Verbose to get extra info
>>>>
>>>> David
>>>>
>>>> Pete Brunet said the following on 08/03/10 02:57:
>>>>         
>>>>> Thanks David, Those options tell me which classes were succesfully
>>>>> loaded but not what classes the class loader was trying to load
>>>>> when the
>>>>> class loader was attempting to load SwingEventMonitor.  Is there a way
>>>>> to get a deeper dump while a particular class is being loaded?  -Pete
>>>>>
>>>>> David Holmes wrote:
>>>>>           
>>>>>> Try -verbose:class or -XX:+TraceClassLoading
>>>>>>
>>>>>> HTH
>>>>>>
>>>>>> David Holmes
>>>>>>
>>>>>> Pete Brunet said the following on 07/31/10 07:53:
>>>>>>             
>>>>>>> This blog post has been helpful to at least start the investigation:
>>>>>>> http://www.jroller.com/sjivan/entry/difference_between_classnotfoundexception_and_noclassdeffounderror
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> However, I haven't found anything yet similar to the cases
>>>>>>> discussed in
>>>>>>> the blog entry.  Since SwingEventMonitor was last updated for 1.4
>>>>>>> I do
>>>>>>> see the use of Class and ListModel instead of Class<T> and
>>>>>>> ListModel<T>
>>>>>>> but it seems like this would not cause a NoClassDefFoundError.
>>>>>>>
>>>>>>> Other than visual inspection (which I've done) is there a technique
>>>>>>> for
>>>>>>> determining what classes the class loader is attempting to load as
>>>>>>> SwingEventMonitor is being loaded?
>>>>>>>
>>>>>>> Thanks, Pete
>>>>>>>
>>>>>>> Pete Brunet wrote:
>>>>>>>               
>>>>>>>> What is the correct way to fix this?
>>>>>>>>
>>>>>>>> Exception in thread "AWT-EventQueue-0"
>>>>>>>> java.lang.NoClassDefFoundError:
>>>>>>>> com/sun/java/accessibility/util/SwingEventMonitor
>>>>>>>>         at
>>>>>>>> sun.awt.windows.accessibility.AccessibleContextMirror.<init>(AccessibleContextMirror.java:583)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> This class lives in jaccess-1_4.jar which I copy to lib\ext and is
>>>>>>>> documented here:
>>>>>>>> http://download.oracle.com/docs/cd/E17802_01/j2se/javase/technologies/accessibility/docs/jaccess-1.3/doc/api/com/sun/java/accessibility/util/package-summary.html
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Since (as far as I know) this class isn't part of the OpenJDK I
>>>>>>>> expected
>>>>>>>> javac to fail but it didn't (at least as far as the log shows):
>>>>>>>>
>>>>>>>> ...
>>>>>>>> # Java sources to be compiled: (listed in file
>>>>>>>> c:/OPF6CE~1/jdk7/build/WINDOW~2/tmp/sun/sun.awt/awt/.classes.list)
>>>>>>>> ../../../src/windows/classes/sun/awt/windows/Accessibility/AccessibleContextMirror.java
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> # Running javac:
>>>>>>>> c:/OPF6CE~1/jdk7/build/WINDOW~2/J2SDK-~1/bin/javac
>>>>>>>> -J-XX:ThreadStackSize=768 -J-XX:-PrintVMOptions
>>>>>>>> -J-XX:+UnlockDiagnosticVMOptions -J-XX:-LogVMOutput -J-client
>>>>>>>> -J-Xmx395m
>>>>>>>> -J-Xms128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m -source 7
>>>>>>>> -target 7
>>>>>>>> -encoding ascii
>>>>>>>> -Xbootclasspath:c:/OPF6CE~1/jdk7/build/WINDOW~2/classes
>>>>>>>> -sourcepath
>>>>>>>> c:/OPF6CE~1/jdk7/build/WINDOW~2/gensrc;../../../src/windows/classes;../../../src/share/classes
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -d c:/OPF6CE~1/jdk7/build/WINDOW~2/classes
>>>>>>>> @c:/OPF6CE~1/jdk7/build/WINDOW~2/tmp/sun/sun.awt/awt/.classes.list.filtered
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> /usr/bin/mkdir -p
>>>>>>>> c:/OPF6CE~1/jdk7/build/WINDOW~2/tmp/sun/sun.awt/awt/obj
>>>>>>>> ...
>>>>>>>>
>>>>>>>> The source for SwingEventMonitor isn't in any of the three
>>>>>>>> directories
>>>>>>>> in the -sourcepath.
>>>>>>>>
>>>>>>>> What files should I provide and where should I put them, both for
>>>>>>>> compile time and run time?
>>>>>>>>
>>>>>>>> Thanks, Pete
>>>>>>>>   
>>>>>>>>                 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/build-dev/attachments/20100803/8ba95379/attachment.htm>


More information about the build-dev mailing list