Java问题让我抓狂

Java问题让我抓狂

当我尝试打开特定的 .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

答案1

从我用来修复 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

保存文件。再试一次。它应该有效。

答案2

下载以前版本的 Java 运行时(例如 1.7 或 1.6)并使用此版本运行它。位置位于页面底部http://www.oracle.com/technetwork/java/javase/downloads/index.html

正如页面所述:

警告:这些旧版本的 JRE 和 JDK 旨在帮助开发人员调试旧系统中的问题。它们未使用最新的安全补丁进行更新,不建议在生产中使用。

在我们的案例中,您别无选择,因为 Cisco 没有提供更新的签名 jar 来访问您的 Cisco ASA。

要使用旧版本运行它,请不要忘记提供完整路径,例如 Windows

c:\tools\jdk1.6.0_95\bin\javaw.exe https://192.168.0.5/admin/public/asdm.jnlp 

或者 Linux

/opt/jdk1.6.0_67/bin/javaws https://192.168.0.5/admin/public/asdm.jnlp 

相关内容