带签名的 Java Web Start

发布于 2024-11-16 08:11:18 字数 3286 浏览 6 评论 0原文

总之,

我在运行由 Netbeans 7 生成的 java web start 应用程序时遇到了一些问题。

我已将现有的 java 6.9.1 应用程序迁移到 Netbeans 7 并尝试将其设为 Web start 应用程序。

为此,我从项目属性中选中了启用 Web Start 选项。

对于代码库选项,我选择了 Web 应用程序部署。 选择应用程序描述符选项,该选项会将 JNLP application-desc 元素指向我的应用程序主类。

为了进行签名,我生成了一个密钥并将签名属性指向此密钥。我将混合代码设置为“仅受信任”,因为我的应用程序将仅使用签名的 JAR。

编译时,所有引用的 JAR 文件和应用程序 JAR 文件都会被签名,并在控制台中输出(对于每个文件):

Signing JAR: D:\MyCode\dist\lib\somejarfile.jar to D:\MyCode\dist\lib\somejarfile.jar as signFiles
Enter Passphrase for keystore: Enter key password for signFiles: 

注意: signFiles 是我在 Netbeans 的签名属性中使用的别名。

在我的 dist 文件夹中创建以下文件:

  • lib
  • jnlpcomponent1.jnlp
  • launch.html
  • launch.jnlp
  • README.TXT
  • 我的 App.jar

我已将这些文件复制到托管在 tomcat 下的 Web 文件夹,即 C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\mywebapp。

我在 IE 和 Firefox 中从以下 URL 运行: http://mylaptop:8080/mywebapp/launch.html

当我点击时抛出以下异常launch.html 中用于启动 JNLP 文件的按钮:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/panderson/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/B3UCQV8C/$$codebase/launch.jnlp
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.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(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)

我的 launch.jnlp 文件具有以下内容:

<jnlp codebase="$$codebase" href="launch.jnlp" spec="1.0+">
...
<resources>
    <j2se version="1.6+"/>
    <jar href="My App.jar" main="true"/>
...

我不太确定为什么它在 Internet Explorer 中的临时文件夹下查找...

...但我尝试将完整网址在launch.JNLP文件的jnlp href中 http://mylaptop:8080/mywebapp/launch.jnlp 然后它会抛出以下异常:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/panderson/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/DR2O6URQ/$$codebase/My App.jar

如果我随后将 jar href 更改为 http://mylaptop:8080/mywebapp/My App.jar,点击launch.html中的按钮运行launch.JNLP文件时抛出以下异常。

BadFieldException[ The field <jnlp>codebase has an invalid value: $$codebase,$$codebase]

有什么帮助或想法吗?

干杯,

安德斯

All,

I am having some trouble running a java web start application that has been generated by Netbeans 7.

I have migrated my existing java 6.9.1 application to Netbeans 7 and attempted to make it a web start application.

To do this I have checked the Enable Web Start option from the project properties.

For the codebase option I have Web Application Deployment selected.
The Application descriptor is selected option which will point the JNLP application-desc element to my applications main class.

For signing, I have generated a key and pointed the Signing properties at this. I have the Mixed Code set to Trusted Only as my application will only used signed JARs.

When I compile, all referenced JAR files and the application JAR file are signed which is output in the console (for each one) as:

Signing JAR: D:\MyCode\dist\lib\somejarfile.jar to D:\MyCode\dist\lib\somejarfile.jar as signFiles
Enter Passphrase for keystore: Enter key password for signFiles: 

NOTE: signFiles is the alias I have used in the Signing properties in Netbeans.

The following files are created in my dist folder:

  • lib
  • jnlpcomponent1.jnlp
  • launch.html
  • launch.jnlp
  • README.TXT
  • My App.jar

I have copied these to my web folder that is hosted under tomcat which is C:\Program Files\Apache Software Foundation\Tomcat 7.0\webapps\mywebapp.

I am running from the following URL in IE and Firefox:
http://mylaptop:8080/mywebapp/launch.html

The following exception is thrown when I click the button in launch.html to launch the JNLP file:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/panderson/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/B3UCQV8C/$codebase/launch.jnlp
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.deploy.net.DownloadEngine.getResource(Unknown Source)
at com.sun.javaws.Launcher.updateFinalLaunchDesc(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)

My launch.jnlp file has the following:

<jnlp codebase="$codebase" href="launch.jnlp" spec="1.0+">
...
<resources>
    <j2se version="1.6+"/>
    <jar href="My App.jar" main="true"/>
...

I am not too sure why it is looking under the temp folders in internet explorer for it...

... But I have tried putting the full url in the jnlp href to the launch.JNLP file http://mylaptop:8080/mywebapp/launch.jnlp then it throws the following exception:

com.sun.deploy.net.FailedDownloadException: Unable to load resource: file:/C:/Users/panderson/AppData/Local/Microsoft/Windows/Temporary Internet Files/Content.IE5/DR2O6URQ/$codebase/My App.jar

If I then change the jar href to http://mylaptop:8080/mywebapp/My App.jar, the following exception is thrown when I click the button in the launch.html to run the launch.JNLP file.

BadFieldException[ The field <jnlp>codebase has an invalid value: $codebase,$codebase]

Any help or thoughts?

Cheers,

Andez

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

流绪微梦 2024-11-23 08:11:18
<jnlp codebase="$codebase" href="launch.jnlp" spec="1.0+">

这些 $$ 占位符值通常由 servlet 或类似功能转换为有意义的值。

<jnlp codebase="$codebase" href="launch.jnlp" spec="1.0+">

These $$ place-holder values are usually translated to something sensible by a servlet or similar functionality.

你如我软肋 2024-11-23 08:11:18

在以下问题中建议将此作为有用的工具。

尝试使用 JaNeLA 并查看它是否发现您的 JNLP 文件有任何问题。

进一步仔细检查并确保codebase url 与您的服务器/应用程序的 url 匹配。

This was suggested as a useful tool in the following question.

Try using JaNeLA and see if it finds any problems with your JNLP file.

Further double check and make sure the codebase url matches the url of your server/application.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文