所有,
我在运行由Netbeans 7生成的java Web Start应用程序时遇到了一些麻烦 .
我已将现有的Java 6.9.1应用程序迁移到Netbeans 7,并尝试将其作为Web启动应用程序 .
为此,我已从项目属性中选中了“启用Web Start”选项 .
对于codebase选项,我选择了Web Application Deployment . 选择Application描述符选项,它将JNLP application-desc元素指向我的应用程序主类 .
为了签名,我已经生成了一个密钥并指向了Signing属性 . 我将混合代码设置为仅受信任,因为我的应用程序将仅使用已签名的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:
NOTE: signFiles是我在Netbeans的Signing属性中使用的别名 .
在我的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的临时文件夹下查找...
...但我已经尝试将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
如果我然后将jar href更改为http://mylaptop:8080/mywebapp/My App.jar,则单击launch.html中的按钮以运行launch.JNLP文件时,将引发以下异常 .
BadFieldException[ The field <jnlp>codebase has an invalid value: $$codebase,$$codebase]
任何帮助或想法?
干杯,
Andez
2 回答
这些$$占位符值通常被转换为servlet或类似功能合理的东西 .
这被建议作为以下question中的有用工具 .
尝试使用JaNeLA,看看它是否发现您的JNLP文件有任何问题 .
进一步仔细检查并确保
codebase
url与您的服务器/应用程序的URL匹配 .