Non-Java exception raised, not handled (Error creating CGSWindow)

Update: It seems that MacWidgets causes this problem. In the applications main frame I added the line


If I disable (comment out) this line there will no exceptions. What a..

The structure of components: One Mainframe with BorderLayout (Toolbar, Sidebar and MainContent). The MainContent contains eventually the graph, the corresponding satellite component is in the sidebar.

Original post:

I had already posted about it last week. But now it seems that is was not a reasonable solution.

I have a java swing application which uses standard java swing elements and the jung2 graph framework visualizing graphs. The application is developed under java 1.6 and mac os x 10.5.6.

The actual problem is that since yesterday the AWT-Eventthread crashed, for example like this:

Thu May 7 15:04:28 X.localdomain java[2002]Â : CGSResolveShmemReference : reference offset (65232) exceeds bounds (32768) on shmem obj 0x257e
Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: Non-Java exception raised, not handled! (Original problem: Error (1000) creating CGSWindow)
at apple.awt.CRenderer.doRect(Native Method)
at apple.awt.OSXSurfaceData.doRect(
at apple.awt.CRenderer.fillRect(
at apple.awt.CRenderer.fillRect(
at sun.java2d.pipe.ValidatePipe.fillRect(
at sun.java2d.SunGraphics2D.fillRect(
at edu.uci.ics.jung.visualization.BasicVisualizationServer.renderGraph(
at edu.uci.ics.jung.visualization.BasicVisualizationServer.paintComponent(
at javax.swing.JComponent.paint(
at javax.swing.JComponent.paintChildren(
at javax.swing.JComponent.paint(
at javax.swing.JComponent._paintImmediately(
at javax.swing.JComponent.paintImmediately(
at javax.swing.RepaintManager.paintDirtyRegions(
at javax.swing.RepaintManager.paintDirtyRegions(
at javax.swing.RepaintManager.seqPaintDirtyRegions(
at javax.swing.SystemEventQueueUtilities$
at java.awt.event.InvocationEvent.dispatch(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForFilters(
at java.awt.EventDispatchThread.pumpEventsForFilter(
at java.awt.EventDispatchThread.pumpEventsForHierarchy(
at java.awt.EventDispatchThread.pumpEvents(
at java.awt.EventDispatchThread.pumpEvents(

This happens in the event thread, so the application is „still“ useable. Well, of course, the graph painting is a mess.

After googling, I found some solutions:

  1. Execute the file access rights (permissions)-fix via disk utilities & reboot the maschine. Yes, this will fix the problem for some starts, but then.. what a dejavu.
  2. Assure that the paint-process is not outside of the awt-thread.. yes it is. See trace. (Link
  3. Exclude the SWT jar.. well, I do not use this and I have not include it. (Link
  4. Use not the apple ui manager.. well, i replace the manager for the components of jung, i disabled my own selfwritten graph vertex renderer.. no changes. No less exceptions, nothing.

Perhaps this could be an issue by jung, but..

  • why only on this mac – but no error/exception on others systems like windows and linux? Also I have a 2 years older macbookpro.. no problem there.
  • why, or some time, is there no problem after fixing the file access rights (permissions) and rebooting the machine?

Currently, I have no solution.. the exeptions raises while painting the graph (which uses many paint()/Graphs objects ofc) moving/zooming it. I was able to catch some of the strange exceptions overriding the default visualizerviewer (by jung) and put in a small try-catch-wrapper of the corresponding method (here renderGraph). But other exceptions raised within javax.swing.Component and so on…

And.. how strange: the line

Thu May  7 15:04:28 X.localdomain java[2002] <Warning>: CGSResolveShmemReference : reference offset (65232) exceeds bounds (32768) on shmem obj 0x257e

is not an output by the java exception but from the failed native method. The numbers: 32768 (=2^15) and 65232 (2^16 -4). 64bit-problem?

I’m very appreciate if someone has an idea or solution.

2 Gedanken zu „Non-Java exception raised, not handled (Error creating CGSWindow)“

Kommentar verfassen

This site uses Akismet to reduce spam. Learn how your comment data is processed.