How do I solve this NPE from trying to use Journey Browser

134 views Asked by At

Using journey browser project I have set up a simple maven project in eclipse, using the dependency provided on the page, I have tried to run the code example (also provided on the page)

And I get an NPE:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at java.base/java.lang.Class.forName0(Native Method)
    at java.base/java.lang.Class.forName(Class.java:315)
    at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:588)
    at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:583)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.desktop/java.awt.Toolkit.getDefaultToolkit(Toolkit.java:582)
    at java.desktop/java.awt.Toolkit.getEventQueue(Toolkit.java:1494)
    at java.desktop/java.awt.EventQueue.isDispatchThread(EventQueue.java:1086)
    at java.desktop/javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1493)
    at com.codebrig.journey.JourneyBrowserView.<init>(JourneyBrowserView.java:78)
    at com.codebrig.journey.JourneyBrowserView.<init>(JourneyBrowserView.java:71)
    at JourneyBrowser.main(JourneyBrowser.java:13)
Caused by: java.lang.NullPointerException
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2646)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
    at java.base/java.lang.System.loadLibrary(System.java:1870)
    at java.desktop/sun.awt.windows.WToolkit$1.run(WToolkit.java:118)
    at java.desktop/sun.awt.windows.WToolkit$1.run(WToolkit.java:115)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.desktop/sun.awt.windows.WToolkit.loadLibraries(WToolkit.java:114)
    at java.desktop/sun.awt.windows.WToolkit.<clinit>(WToolkit.java:129)
    ... 12 more

Can anyone explain what is happening and why here, I have tried this on 64bit windows with java Coretto 11(jdk11.0.7_10),I initially found a bug here, relating to loadLibray in open JDK and thought that maybe the problem, I just don't have a good enough understanding to work out how to get around it?

1

There are 1 answers

1
Stephen C On

I'm not sure, but I think that Corretto bug is probably the one that is causing the problem. As noted, it is from their "upstream"; i.e the OpenJDK codebase. It was due to regression that appeared in jdk11.0.7 due to a backport of a fix for another problem. Apparently, the fix changes some internal JDK fields and that breaks application code. As JDK-8240521 puts it:

The backport of the JDK-8231584 changes internal JDK fields processing. The problem is that the many third-party applications copy-pasted a hack that depends on particular JDK implementation.

If I am reading the Oracle bug entries correctly, the reversion of the broken fix should be in JDK11.0.8. Alternatively, an earlier JDK 11 release than 11.0.7 shouldn't have the broken fix.

Let me know if changing your Java 11 install solves the problem. (If not, I'll see if I can get the line numbers to match up.)