如何解决尝试使用 Journey Browser 时出现的空指针异常(NPE)问题。

huangapple go评论121阅读模式
英文:

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

问题

使用 journey browser 项目,我在 Eclipse 中设置了一个简单的 Maven 项目,使用页面上提供的依赖项,我尝试运行页面上提供的代码示例。

然后我遇到了一个空指针异常(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

有人能解释一下发生了什么以及为什么会发生这种情况吗?我在 Windows 64 位系统上使用了 Java Coretto 11(jdk11.0.7_10),最初我在这里发现了一个 bug,与 OpenJDK 中的 loadLibrary 相关,我想也许问题出在这里,只是我理解不够,不知道该如何解决?

英文:

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 &quot;main&quot; 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.&lt;init&gt;(JourneyBrowserView.java:78)
	at com.codebrig.journey.JourneyBrowserView.&lt;init&gt;(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.&lt;clinit&gt;(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

得分: 1

我不确定,但我认为Corretto的错误可能是导致问题的原因之一。正如所指出的,它来自于他们的“上游”;即OpenJDK代码库。这是由于在jdk11.0.7中出现了一个回归,原因是为了修复另一个问题而进行的回退。显然,该修复更改了一些内部JDK字段,从而破坏了应用程序代码。正如JDK-8240521中所述:

JDK-8231584的回退更改了内部JDK字段处理。问题在于许多第三方应用程序复制并粘贴了一种依赖于特定JDK实现的hack。

如果我正确地阅读Oracle的错误条目,修复这个问题的还原版本应该在JDK11.0.8中。或者,早于11.0.7的JDK 11版本不应该有这个破损的修复。

如果更改您的Java 11安装是否解决了问题,请告诉我。(如果没有,我将查看是否可以使行号匹配。)

英文:

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

huangapple
  • 本文由 发表于 2020年10月14日 17:38:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/64350518.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定