diff -ruN openjdk.orig/jdk/src/share/classes/sun/applet/AppletViewerPanel.java openjdk/jdk/src/share/classes/sun/applet/AppletViewerPanel.java
--- openjdk.orig/jdk/src/share/classes/sun/applet/AppletViewerPanel.java	2010-09-17 15:01:01.790221354 -0400
+++ openjdk/jdk/src/share/classes/sun/applet/AppletViewerPanel.java	2010-09-17 15:17:21.758076505 -0400
@@ -199,7 +199,22 @@
      * also implemented by the AppletPanel class.
      */
     public AppletContext getAppletContext() {
-        return (AppletContext)getParent();
+        Object parent = getParent();
+        int nullCount = 0;
+        final int ERROR_THRESHOLD = 1000;
+        // the AppletViewerPanel is reparented during initialization and 
+        // there is a small window of time where it has no parent
+        while (parent == null) {
+            Thread.yield();
+            nullCount++;
+            // if we have waited too long and still dont have a parent, 
+            // something is very wrong; dont try to mask it
+            if (nullCount == ERROR_THRESHOLD) {
+                return null;
+            }
+            parent = getParent();
+        }
+        return (AppletContext)parent;
     }
 
     protected static void debug(String s) {