Java Web Start Jar签名问题?

时间:2012-07-26 16:21:31

标签: java jnlp java-web-start

我正在尝试通过Java Web Start运行这个Java应用程序(jar),并且遇到了非常困难的时间。

这是我目前的JNLP来源:

<?xml version="1.0" encoding="utf-8"?> 
<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
    <information>
        <title>Jnlp Testing</title>
        <vendor>YONG MOOK KIM</vendor>
        <homepage href="http://localhost:8080/" />
        <description>Testing Testing</description>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <j2se version="1.6+" />
        <jar href="TestJnlp.jar" />
        <jar href="lib/appframework-1.0.3.jar"/>
        <jar href="lib/junit-4.7.jar"/>
        <jar href="lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar"/>
        <jar href="lib/org-netbeans-modules-java-j2seproject-copylibstask.jar"/>
        <jar href="lib/sqlite-jdbc-3.7.2.jar"/>
        <jar href="lib/swing-worker-1.1.jar"/>
    </resources>
    <application-desc main-class="proteotypic.ProteotypicQuantificationApp" />
</jnlp>

运行JNLP文件后,出现以下错误:

JNLPException[category: Launch File Error : Exception: null : LaunchDesc:

---- here the JNLP ----

at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.security.JNLPSignedResourcesHelper.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

我签署了除lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar以外的所有邮箱 - 如果我也签了那个,我会得到一个不同的例外:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://localhost:8080/lib/org.eclipse.swt.win32.win32.x86_64_3.100.0.v4233d.jar
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

java.io.IOException: invalid SHA1 signature file digest for org/eclipse/swt/awt/SWT_AWT$4.class
at com.sun.deploy.cache.CacheEntry$9.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.cache.CacheEntry.writeFileToDisk(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToTempFile(Unknown Source)
at com.sun.deploy.cache.Cache.downloadResourceToCache(Unknown Source)
at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)
at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.LaunchDownload$DownloadTask.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

在执行“javaws -viewer”并重新运行JNLP后,我得到:

https://gist.github.com/3183636

3 个答案:

答案 0 :(得分:2)

所有jars 在一个jnlp 中需要使用相同的签名进行签名,使用带有自己的jnlp的扩展名来存放由第三方签名的jar。

有些jar使用jar中的原始签名进行加密(SQL服务器的JDBC驱动程序),其他人在重新签名时不起作用(javahelp.jar)

您还可以通过将其包含在应用程序的jnlp:

中来节省签名的麻烦
<extension name="javahelp" href="javahelp.jnlp"/>

答案 1 :(得分:1)

您必须签署jar文件。您可以使用keytool自行完成此操作,但如果您打算部署此功能,我建议您使用Verisign或类似公司进行签名。

如果您只需要临时修复,signing it yourself进行测试就可以了。

这是一款易于使用的tutorial

答案 2 :(得分:1)

所有罐子必须使用相同的签名进行签名。