简体   繁体   English

Java Web Start with Signed

[英]Java Web Start with Signed

All, 所有,

I am having some trouble running a java web start application that has been generated by Netbeans 7. 我在运行由Netbeans 7生成的java Web启动应用程序时遇到了一些麻烦。

I have migrated my existing java 6.9.1 application to Netbeans 7 and attempted to make it a web start application. 我已将现有的Java 6.9.1应用程序迁移到Netbeans 7,并尝试将其作为Web启动应用程序。

To do this I have checked the Enable Web Start option from the project properties. 为此,我已从项目属性中选中了“启用Web Start”选项。

For the codebase option I have Web Application Deployment selected. 对于codebase选项,我选择了Web Application Deployment。 The Application descriptor is selected option which will point the JNLP application-desc element to my applications main class. 选择Application描述符选项,它将JNLP application-desc元素指向我的应用程序主类。

For signing, I have generated a key and pointed the Signing properties at this. 为了签名,我已经生成了一个密钥并指向了Signing属性。 I have the Mixed Code set to Trusted Only as my application will only used signed JARs. 我将混合代码设置为仅受信任,因为我的应用程序将仅使用已签名的JAR。

When I compile, all referenced JAR files and the application JAR file are signed which is output in the console (for each one) as: 当我编译时,所有引用的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: 

NOTE: signFiles is the alias I have used in the Signing properties in Netbeans. 注意: signFiles是我在Netbeans的Signing属性中使用的别名。

The following files are created in my dist folder: 在我的dist文件夹中创建以下文件:

  • lib LIB
  • jnlpcomponent1.jnlp jnlpcomponent1.jnlp
  • launch.html launch.html
  • launch.jnlp launch.jnlp
  • README.TXT README.TXT
  • My App.jar 我的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. 我已将这些文件复制到托管在tomcat下的我的web文件夹,即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 我在IE和Firefox中运行以下URL: http:// mylaptop:8080 / mywebapp / launch.html

The following exception is thrown when I click the button in launch.html to launch the JNLP file: 当我单击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)

My launch.jnlp file has the following: 我的launch.jnlp文件包含以下内容:

<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... 我不太清楚为什么它在Internet Explorer的临时文件夹下寻找它...

... 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: ...但我已经尝试将jnlp href中的完整url放入launch.JNLP文件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

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. 如果我然后将jar href更改为http:// mylaptop:8080 / mywebapp / My App.jar,则单击launch.html中的按钮以运行launch.JNLP文件时,将引发以下异常。

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

Any help or thoughts? 任何帮助或想法?

Cheers, 干杯,

Andez Andez

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

这些$$占位符值通常被转换为servlet或类似功能合理的东西。

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. 尝试使用JaNeLA ,看看它是否发现您的JNLP文件有任何问题。

Further double check and make sure the codebase url matches the url of your server/application. 进一步仔细检查并确保codebase URL与您的服务器/应用程序的URL匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM