DefaultGraphicsConfiguration cannot be cast to AWTGraphicsConfiguration, and null GLContext

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

DefaultGraphicsConfiguration cannot be cast to AWTGraphicsConfiguration, and null GLContext

Matt.M
Hey guys,

I'm having an issue with getting jogl to render inside of an add-on module for a Java WebStart based program. When I compile the program and run it as a standalone, everything works great, however when I try to add it to my project it doesn't seem to want to work properly.

There are 2 places I'm trying to render to, and each is giving me a separate issue. The first one is inside a web launched client it is giving me this error:

java.lang.ClassCastException: com.jogamp.nativewindow.DefaultGraphicsConfiguration cannot be cast to com.jogamp.nativewindow.awt.AWTGraphicsConfiguration
        at com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1560)
        at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:611)
        at java.awt.Container.addNotify(Unknown Source)
        at javax.swing.JComponent.addNotify(Unknown Source)
        at com.jogamp.opengl.awt.GLJPanel.addNotify(GLJPanel.java:666)
        at java.awt.Container.addNotify(Unknown Source)
        at javax.swing.JComponent.addNotify(Unknown Source)
        at java.awt.Container.addNotify(Unknown Source)
        at javax.swing.JComponent.addNotify(Unknown Source)
        at java.awt.Container.addNotify(Unknown Source)
        at javax.swing.JComponent.addNotify(Unknown Source)
        at java.awt.Container.addNotify(Unknown Source)
        at javax.swing.JComponent.addNotify(Unknown Source)
        at javax.swing.JRootPane.addNotify(Unknown Source)
        at java.awt.Container.addNotify(Unknown Source)
        at javax.swing.JComponent.addNotify(Unknown Source)
        at java.awt.Container.addImpl(Unknown Source)
        at javax.swing.JLayeredPane.addImpl(Unknown Source)
        at javax.swing.JDesktopPane.addImpl(Unknown Source)
        at com.inductiveautomation.factorypmi.application.VisionDesktop.addImpl(VisionDesktop.java:345)
        at java.awt.Container.add(Unknown Source)
        at com.inductiveautomation.factorypmi.application.VisionDesktop$RuntimeWindowOpener.openWindow(VisionDesktop.java:510)
        at com.inductiveautomation.factorypmi.application.VisionDesktop.openWindow(VisionDesktop.java:193)
        at com.inductiveautomation.factorypmi.application.VisionDesktop.openWindow(VisionDesktop.java:185)
        at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities$1.run(NavUtilities.java:210)
        at com.inductiveautomation.factorypmi.application.script.builtin.WindowUtilities.doGUIAction(WindowUtilities.java:815)
        at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.swapWindow(NavUtilities.java:208)
        at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.swapTo(NavUtilities.java:117)
        at com.inductiveautomation.factorypmi.application.script.builtin.NavUtilities.swapTo(NavUtilities.java:104)
        at com.inductiveautomation.factorypmi.application.components.tabstrip.PMITabStrip.setSelectedTab(PMITabStrip.java:491)
        at com.inductiveautomation.factorypmi.application.components.tabstrip.TabHolderPanel.mousePressed(TabHolderPanel.java:213)
        at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

I have found similar issues with this same exception, but none of the solutions are applicable or viable for my scenario. Most of them are about raspberry pi and Newt, or call for using Java 6, which I can't do in this case.

The second issue is in the designer, it doesn't even throw an exception, but after some digging I found out that the GLContext is not initializing. I can see the component, it shows up as a black rectangle that says its canvas instance name (canvas0, canvas1, etc) but my GLContext is null.

I have tried to have the program create a new GLContext with AutoDrawables generated by events at runtime, giving the application its own external window, putting it on its own thread and then doing both of the above to create a GLContext on that thread for that window and set it as current. No matter what I do, the GLContext is coming back null. Any suggestions?
Reply | Threaded
Open this post in threaded view
|

Re: DefaultGraphicsConfiguration cannot be cast to AWTGraphicsConfiguration, and null GLContext

gouessej
Administrator
Hi

Applets are deprecated in Java 1.9 and probably removed from Java 1.10, I fear that Java Webstart will follow a similar path later. If you plan to work on your software on the long term, I advise you to look for another deployment solution. Is your first problem reproducible without Java Webstart?

We'll need some information to reproduce your bug and a SSCCE:
http://jogamp.org/wiki/index.php/Jogl_FAQ#Bugreports_.26_Testing

Maybe there's a problem with your graphics card driver, that's why you must provide some information.
Julien Gouesse | Personal blog | Website