<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The failure is on this line of code:<br>
AWTEventMonitor.addFocusListener(this)<br>
which resides in ...\classes\sun\awt\windows\accessibility<br>
<br>
AWTEventMonitor is a class in jaccess-1_4.jar which is in lib/ext<br>
<br>
However, just before the failing line is executed, a println shows
these two system properties<br>
java.ext.dir: null<br>
java.class.path: \Program
Files\Java\jdk1.6.0_20\demo\jfc\SwingSet2\SwingSet2.jar<br>
<br>
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).<br>
<br>
Since I suspect I'll eventually merge this package into the jdk, to
continue debugging I extracted the jar into the classes directory.<br>
<br>
Pete<br>
===<br>
Pete Brunet wrote:
<blockquote cite="mid:4C57A5A5.5080701@oracle.com" type="cite">
<pre wrap="">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 ...
</pre>
<blockquote type="cite">
<pre wrap="">stop at sun.awt.windows.accessibility.AccessibleContextMirror:584
</pre>
</blockquote>
<pre wrap=""><!---->Deferring breakpoint
sun.awt.windows.accessibility.AccessibleContextMirror:584.
It will be set after the class is loaded.
</pre>
<blockquote type="cite">
<pre wrap="">run
</pre>
</blockquote>
<pre wrap=""><!---->run SwingSet2
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
</pre>
<pre wrap=""><!---->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
</pre>
<blockquote type="cite">
<pre wrap="">Set deferred all java.lang.NoClassDefFoundError
</pre>
</blockquote>
<pre wrap=""><!---->
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:
</pre>
<blockquote type="cite">
<pre wrap="">You add it in conjunction with the -XX:+TraceClassLoading.
David
Pete Brunet said the following on 08/03/10 10:15:
</pre>
<blockquote type="cite">
<pre wrap="">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:
</pre>
<blockquote type="cite">
<pre wrap="">Peter,
Try adding -XX:+Verbose to get extra info
David
Pete Brunet said the following on 08/03/10 02:57:
</pre>
<blockquote type="cite">
<pre wrap="">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:
</pre>
<blockquote type="cite">
<pre wrap="">Try -verbose:class or -XX:+TraceClassLoading
HTH
David Holmes
Pete Brunet said the following on 07/31/10 07:53:
</pre>
<blockquote type="cite">
<pre wrap="">This blog post has been helpful to at least start the investigation:
<a class="moz-txt-link-freetext" href="http://www.jroller.com/sjivan/entry/difference_between_classnotfoundexception_and_noclassdeffounderror">http://www.jroller.com/sjivan/entry/difference_between_classnotfoundexception_and_noclassdeffounderror</a>
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:
</pre>
<blockquote type="cite">
<pre wrap="">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:
<a class="moz-txt-link-freetext" href="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">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</a>
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
</pre>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>