NPE in JoglPipeline on Java 17 (works on Java 11)

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

NPE in JoglPipeline on Java 17 (works on Java 11)

juancho
Hi, I am trying to migrate a project from Java 11 to 17. One of the modules, which uses Java3d throws the following exception:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "com.jogamp.nativewindow.awt.AWTGraphicsConfiguration.getAWTGraphicsConfiguration()" because "awtConfig" is null
        at org.jogamp.java3d.JoglPipeline.getGraphicsConfig(JoglPipeline.java:8346)
        at org.jogamp.java3d.Canvas3D.getGraphicsConfig(Canvas3D.java:957)
        at org.jogamp.java3d.Canvas3D.<init>(Canvas3D.java:1027)
        at org.jogamp.java3d.Canvas3D.<init>(Canvas3D.java:989)
        at org.jrmarchio.syrac.S3dPanel.<init>(S3dPanel.java:112)
        at org.jrmarchio.syrac.SyracLevels3D.<init>(SyracLevels3D.java:34)
        at org.jrmarchio.syrac.SyracLevels3D$1.run(SyracLevels3D.java:57)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
        at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Using following libs:

jogamp-java3d1.7.1-build-20200222
and  jogamp libs 2.5.0

Note that the program runs well with those libs by just switching java version back to 11

I noticed that in the following code snippet
    GraphicsConfiguration getGraphicsConfig(GraphicsConfiguration gconfig) {
a        GraphicsConfigInfo gcInf0 = (GraphicsConfigInfo)Canvas3D.graphicsConfigTable.get(gconfig);
b        AWTGraphicsConfiguration awtConfig = (AWTGraphicsConfiguration)gcInf0.getPrivateData();
c        return awtConfig.getAWTGraphicsConfiguration();
    }

Line a returns a GraphicsConfigInfo with a null privateData field, so line b makes awtConfig null and then the following line is a NPE

That is as far as I followed it

Any suggestion to make it work would be appreciated
---
Juan

Reply | Threaded
Open this post in threaded view
|

Re: NPE in JoglPipeline on Java 17 (works on Java 11)

hharrison
https://forum.jogamp.org/Java17-compatibility-error-tp4043006p4043010.html

You'll need to use some add-opens to make things work on java 17 and newer.

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: NPE in JoglPipeline on Java 17 (works on Java 11)

gouessej
Administrator
In reply to this post by juancho
Hello

Harvey is right. Moreover, keep in mind that Java3D 1.7.2 is available:
https://jogamp.org/deployment/maven-java3d/
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: NPE in JoglPipeline on Java 17 (works on Java 11)

juancho
Thank you Harvey and Julien for your replies.

After setting the add-opens properly (as VM parameters, instead of program arguments ), program worked on java 17

---
Juan
Reply | Threaded
Open this post in threaded view
|

Re: NPE in JoglPipeline on Java 17 (works on Java 11)

gouessej
Administrator
You're welcome. We'll have to drive things less painful by "modularizing" JogAmp itself :s
Julien Gouesse | Personal blog | Website