1

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?

Link19
  • 586
  • 1
  • 18
  • 47
  • What precise version of Java produced that stacktrace? – Stephen C Oct 14 '20 at 10:23
  • Yes ... but which version produced >>that<< stacktrace? (It wasn't both of them ...) – Stephen C Oct 14 '20 at 10:34
  • @StephenC My apologies! Eclipse was just using rhe same run configuration so it's working with Oracle 1.8 however i can't deploy with that, it's Correto 11 that's the issue. – Link19 Oct 14 '20 at 10:43
  • So are you saying that Coretto 11(jdk11.0.7_10) produced that? ('cos the line numbers didn't match with the Java 11 source tree I was looking at ...) – Stephen C Oct 14 '20 at 10:48
  • @StephenC yes, that's correct, I only have 2 jdks installed and the 1.8 one is working, when I use Coretto 11(jdk11.0.7_10) that is the stack trace I get. – Link19 Oct 14 '20 at 10:54

1 Answers1

1

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.)

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • 11.0.8 does seem to have got past that exception, I'm now on to: java.lang.NoClassDefFoundError: com/jogamp/opengl/awt/GLCanvas – Link19 Oct 14 '20 at 11:42