正确签名的 JNLP 应用程序无法在 Java 7 中运行

2024-05-16

我有一个 JNLP 应用程序,由于证书过期需要更新。我有一个经过 CA 验证的新证书。我已将新证书导入到我的密钥库中 - 我已导入完整的证书链。

我的构建文件对构建中的 jar 进行签名和时间戳

    <signjar alias="myAlias"
            keystore="myKeystore"
            storepass="storepass"
            keypass="keypass"
            lazy="false"
            tsaurl="http://timestamp.globalsign.com/scripts/timestamp.dll">
        <path>
            <fileset dir="${app.dist.dir}" includes="**/*.jar" />
        </path>
    </signjar>

编译后我可以使用 jarsigner 验证 jar 文件。一切检查都正常,“jar 已验证”,没有任何警告。

使用 Java 6 编译并使用类似的东西运行应用程序

"C:\Program Files\Java\jdk1.6.0_38\bin\javaws.exe" -verbose start.jnlp

工作正常。弹出窗口告诉我该应用程序已正确认证。我可以查看证书,一切看起来都很好。

使用 Java 7 编译并使用类似的东西运行应用程序

"C:\Program Files\Java\jdk1.7.0_51\bin\javaws.exe" -verbose start.jnlp

失败。 “Java 安全设置已阻止此应用程序运行。您可以在 Java 控制面板中更改此行为”

我尝试将安全设置降低到“中”,但这不起作用,并且对我来说不是一个可行的解决方案,因为该应用程序可在互联网上使用。

我尝试在 Java 6 中编译并在 Java 7 中运行,得到相同的结果。

我没有收到任何错误消息。我已经这样做了几个小时了,在消除了许多问题和警告之后,我现在完全陷入困境。我已附上 JNLP 文件,它很有帮助!

<?xml version="1.0" encoding="UTF-8"?> 
<jnlp spec="6.0" codebase="http://localgocommunicate1.x.accessacloud.com:8080/a/theaccessgroup.com" href="http://localgocommunicate1.x.accessacloud.com:8080/a/theaccessgroup.com/client/desktop/start.jnlp">
    <information>
        <title>My App</title>
        <vendor>Company Ltd</vendor>
        <homepage href="http://www.myApp.com"/>
        <description>My App</description>
        <description kind="short">My App</description>      
        <icon href="http://localhost:8080/desktopclient/images/icon.gif"/>
        <icon kind="splash" href="http://localhost:8080/desktopclient/images/splash.gif"/>
        <offline-allowed/>
        <shortcut online="true">
            <menu submenu="Startup"/>
            <menu submenu="My App"/>
        </shortcut>
    </information>
    <security>
        <all-permissions/>
    </security>
    <update check="timeout" policy="always"/>
    <!-- Global Resource -->
    <resources>
        <j2se version="1.7*" java-vm-args="-Xmx32m" max-heap-size="32m" href="http://java.sun.com/products/autodl/j2se"/>
        <!-- App Common Resources -->
        <jar href="http://localhost:8080/desktopclient/6/myappclient.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/myappshared.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/myappclient.resources.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/myapplibrary.jar" download="eager"/>
        <!-- Common Resrouces -->
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-logging-1.1.3.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/log4j-1.2.17.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-beanutils-1.9.1.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-codec-1.9.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-collections-3.2.1.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-digester-2.1.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-fileupload-1.3.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-httpclient-3.1.jar" download="eager"/>
        <jar href="http://localhost:8080/desktopclient/6/lib/commons-io-2.4.jar" download="eager"/>
        <!-- JNA -->    
        <jar href="http://localhost:8080/desktopclient/6/lib/jna-4.0.0.jar"/>
    </resources>
    <!-- OS Specific Resources -->
    <resources os="Windows" arch="x86" href="http://java.sun.com/products/autodl/j2se">
        <jar href="http://localhost:8080/desktopclient/6/swt/swt-ws-win32-win32-x86.jar" />
    </resources>
    <resources os="Windows" arch="x86_64" href="http://java.sun.com/products/autodl/j2se">
        <jar href="http://localhost:8080/desktopclient/6/swt/swt-ws-win32-win32-x86_64.jar" />
    </resources>
    <resources os="Windows" arch="amd64" href="http://java.sun.com/products/autodl/j2se">
        <jar href="http://localhost:8080/desktopclient/6/swt/swt-ws-win32-win32-x86_64.jar" />
    </resources>
    <resources os="Mac OS X" arch="x86_64" href="http://java.sun.com/products/autodl/j2se">
        <j2se version="1.6+" java-vm-args="-XstartOnFirstThread"/>
        <jar href="http://localhost:8080/desktopclient/6/swt/swt-ws-cocoa-macosx-x86_64.jar" />
    </resources>
    <application-desc main-class="myappclient.Client">
        <argument>-version</argument>
        <argument>6</argument>
    </application-desc>
</jnlp>

非常感谢任何帮助


好的,我有一个适合我的解决方案。

  1. 确保使用最新版本的 JDK 进行编译,在本例中为 1.7.0_51-b13
  2. 更新 JNLP 文件以强制执行 Java 1.7

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

正确签名的 JNLP 应用程序无法在 Java 7 中运行 的相关文章

随机推荐