Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6607186

ClassCastException casting to sun.awt.Win32GraphicsEnvironment

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • 2d
    • x86
    • windows_vista

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.0.6000] (Vista)

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Dell XPS M1710 laptop

      Eclipse Platform
      Version: 3.3.0
      Build id: I20070621-1340

        Tomcat Plugin com.sysdeo.eclipse.tomcat 3.2.1

      Apache Tomcat 6.0.10



      A DESCRIPTION OF THE PROBLEM :
      Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.HeadlessGraphicsEnvironment cannot be cast to sun.awt.Win32GraphicsEnvironment
      at sun.awt.windows.WToolkit$4.run(WToolkit.java:755)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use the Eclipse IDE with the sysdeo tomcatplugin to start tomcat.
      After tomcat startup, verify a webapp is working.
      Close the lid of the laptop, causing the system to go into sleep, not hibernate.
      Wait till all activity stops.
      Open the lid and log in.
      Eclipse now shows a breakpoint in EventDispatchTread.run()
      After clicking run the following stacktrace is produced:

      Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.HeadlessGraphicsEnvironment cannot be cast to sun.awt.Win32GraphicsEnvironment
      at sun.awt.windows.WToolkit$4.run(WToolkit.java:755)
      at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
      at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
      at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

      The running programs (tomcat, eclipse) do not seem to be bothered by this exception and happily continue.

      The relevant code from the run method looks like this:
      public void run() {
      try {
      pumpEvents(new Conditional() {
      public boolean evaluate() {
      return true;
      }
      });
      } finally {
      /*
      * This synchronized block is to secure that the event dispatch
      * thread won't die in the middle of posting a new event to the
      * associated event queue. It is important because we notify
      * that the event dispatch thread is busy after posting a new event
      * to its queue, so the EventQueue.dispatchThread reference must
      * be valid at that point.
      */
      synchronized (theQueue) {
                      if (theQueue.getDispatchThread() == this) {
                          theQueue.detachDispatchThread();
                      }
                      /*
                       * Event dispatch thread dies in case of an uncaught exception.
                       * A new event dispatch thread for this queue will be started
                       * only if a new event is posted to it. In case if no more
                       * events are posted after this thread died all events that
                       * currently are in the queue will never be dispatched.
                       */
                      /*
                       * Fix for 4648733. Check both the associated java event
                       * queue and the PostEventQueue.
                       */
                      if (theQueue.peekEvent() != null ||
                          !SunToolkit.isPostEventQueueEmpty()) {
                          theQueue.initDispatchThread();
                      }
      AWTAutoShutdown.getInstance().notifyThreadFree(this);
      } <--location of breakpoint in eclipse
      }
          }


      REPRODUCIBILITY :
      This bug can be reproduced always.

            tdv Dmitri Trembovetski (Inactive)
            son Oleg Sukhodolsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: