Java

Java 問題讓我抓狂

  • January 6, 2020

當我嘗試打開特定的 .jnlp 文件時出現此錯誤:

net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize application. The application has not been initialized, for more information execute javaws from the command line.
   at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:813)
   at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:532)
   at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:936)
Caused by: net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed.
   at net.sourceforge.jnlp.runtime.JNLPClassLoader$SecurityDelegateImpl.getClassLoaderSecurity(JNLPClassLoader.java:2393)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.setSecurity(JNLPClassLoader.java:321)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:734)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:285)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.createInstance(JNLPClassLoader.java:357)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:429)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:403)
   at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:805)
   ... 2 more

該文件用於訪問 Cisco ASA 的 ASDM,它一直執行良好,直到昨天……我正在使用另外 4 個類似的文件(因為我有 5 個 ASA),而且這些文件執行良好。

有人可以幫我嗎?提前致謝。

BR。


謝謝你@ryekayo,這是我從命令行得到的:

gaspar@gaspar-Lenovo-ideapad-310-15ISK ~ $ javaws https://192.168.0.5/admin/public/asdm.jnlp
OpenJDK 64-Bit Server VM warning: NewSize (1536k) is greater than the MaxNewSize (1024k). A new max generation size of 1536k will be used.
netx: Initialization Error: Could not initialize application. (Fatal: Application Error: Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed.)
net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize application. The application has not been initialized, for more information execute javaws from the command line.
   at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:813)
   at net.sourceforge.jnlp.Launcher.launchApplication(Launcher.java:532)
   at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:936)
Caused by: net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed.
   at net.sourceforge.jnlp.runtime.JNLPClassLoader$SecurityDelegateImpl.getClassLoaderSecurity(JNLPClassLoader.java:2393)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.setSecurity(JNLPClassLoader.java:321)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.initializeResources(JNLPClassLoader.java:734)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.<init>(JNLPClassLoader.java:285)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.createInstance(JNLPClassLoader.java:357)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:429)
   at net.sourceforge.jnlp.runtime.JNLPClassLoader.getInstance(JNLPClassLoader.java:403)
   at net.sourceforge.jnlp.Launcher.createApplication(Launcher.java:805)
   ... 2 more

從我用來修復 Cisco ASDM 問題的 iDrac 解決方案中複製此內容,發現它有效。

https://velenux.wordpress.com/2017/06/07/workaround-for-javaws-jnpl-error-cannot-grant-permissions-to-unsigned-jars/

您收到如下錯誤:

net.sourceforge.jnlp.LaunchException: Fatal: Application Error: Cannot grant permissions to unsigned jars.

快速解決方法:

找到 java.security 文件。就我而言,它位於/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

然後找到行:

jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024

註釋掉它,複製它,刪除 MD5 字元串。

#jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024

保存文件。再試一次。它應該工作。

引用自:https://serverfault.com/questions/853051