FileNotFoundException 通过 HTTPS 使用 java webstart 1.6 启动 1.4.2 webstart 应用程序 [英] FileNotFoundException starting 1.4.2 webstart application with java webstart 1.6 over HTTPS

查看:63
本文介绍了FileNotFoundException 通过 HTTPS 使用 java webstart 1.6 启动 1.4.2 webstart 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

非常感谢所有愿意花时间阅读的人.

我正在努力制作 webstart Swing 1.4.2_12 应用程序以使用 java webstart 1.6.0_29 启动.

场景如下:

  1. 所有流量都通过 HTTPS 完成
  2. 用户单击网页上的链接以启动应用程序:servlet生成的 jnlp 文件
  3. Java webstart 客户端 (1.6.0_29) 启动并加载应用程序一口气
  4. 因为jnlp描述符java中j2se版本设置为1.4.2_12webstart 1.4.2_12 用于启动应用程序(由1.6.0_29)
  5. Java webstart 1.4.2_12 在启动时失败,声称它找不到一些幽灵javaws2"文件

报告以下消息:

CouldNotLoadArgumentException[ 无法加载指定的文件/URL : C:\DOCUME~1\BENOIT~1.VAT\LOCALS~1\Temp\javaws2]在 com.sun.javaws.Main.launchApp(来源不明)在 com.sun.javaws.Main.continueInSecureThread(来源不明)在 com.sun.javaws.Main$1.run(来源不明)在 java.lang.Thread.run(未知来源)

完整的堆栈跟踪是:

java.io.FileNotFoundException: C:\DOCUME~1\BENOIT~1.VAT\LOCALS~1\Temp\javaws2(文件未找到)在 java.io.FileInputStream.open(本机方法)在 java.io.FileInputStream.(来源不明)在 java.io.FileInputStream.(来源不明)在 com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(来源不明)在 com.sun.javaws.Main.launchApp(来源不明)在 com.sun.javaws.Main.continueInSecureThread(来源不明)在 com.sun.javaws.Main$1.run(来源不明)在 java.lang.Thread.run(未知来源)

  • 禁用 HTTPS 时会发生同样的错误.

以下两个 HTTP 头都由 JNLP servlet 发送到客户端:

缓存控制:空
Pragma : 空

这些头文件是必要的,以防止 IE 在 HTTPS 模式下禁用缓存,从而阻止 java webstart 找到加载的 jnlp 文件(因为它没有被缓存).

  • Mime-type 设置为:application/x-java-jnlp-file

  • 我不明白的是为什么java 1.4.2_12找不到JWS 1.6.0_29加载的jnlp文件?

感谢阅读.

解决方案

@Andrew : 感谢您的关注.

这是我对这个问题的结论.

简而言之:始终在 jnlp 标签中设置 href 属性!

<jnlp spec="1.0+" codebase="htt://myhost/codebase" href="mustSetThisAbsolutelyForJWS-1.4.2_12.jnlp">...</jnlp>

多个 HTTP 调试会话表明:

场景 1:href 属性留空且 JNLP 文件与客户端上的 JWS 1.6 相关联

  1. 用户点击 jnlp 链接,JNLP 文件被下载并缓存浏览器.
  2. JWS 1.6.0_29 启动,然后读取下载的 JNLP 文件.
  3. JWS 1.6.0_29 下载所有 JAR 文件,然后切换到 JWS 1.4.2_12.
  4. JWS 1.4.2_12 启动,然后明显地依次读取 JNLP 文件.
  5. JWS 1.4.2_12 尝试检索由 href 指向的 JNLP 文件属性.
  6. 由于 href 为空,JWS 报告无法加载指定的文件/URL: C:\DOCUME~1\BENOIT~1.VAT\LOCALS~1\Temp\javaws2".(作为旁注,ghost javaws2 有时被命名为 javaws10 或类似名称)

<块引用>

请注意:在这种情况下使用 JWS 1.4 或 1.5 时,应用将启动.该问题仅在使用 JWS 1.6 时出现运行 1.4.2_12 应用程序.JWS 1.5 和 1.6 在没有时不会失败设置了 href 属性.相反,他们只是按原样使用 JNLP,请检查JAR 更新,然后启动应用程序.

场景 2:href 属性设置为适当的值,并且 JNLP 文件与客户端上的 JWS 1.6 相关联

  1. 用户点击 jnlp 链接,JNLP 文件被下载并缓存浏览器.
  2. JWS 1.6.0_29 启动,然后读取下载的 JNLP 文件.
  3. JWS 1.6.0_29 下载所有 JAR 文件,然后切换到 JWS 1.4.2_12.
  4. JWS 1.4.2_12 启动,然后明显地依次读取 JNLP 文件.
  5. JWS 1.4.2_12 尝试检索由 href 指向的 JNLP 文件属性.
  6. JWS 1.4.2_12 下载由 href 属性指向的 JNLP.
  7. JWS 1.4.2_12 下载新下载的 JNLP 文件中引用的所有 JNLP JAR 文件.
  8. JWS 1.4.2_12 正确启动应用程序.

这对我来说是一个严重的颈部疼痛,我花了几天时间才弄清楚这一点.希望有一天这会对某人有所帮助.

And many thanks to all who will take time for reading.

I'm struggling to make a webstart Swing 1.4.2_12 application to launch with java webstart 1.6.0_29.

Here is the scenario :

  1. All traffic is done over HTTPS
  2. User clics a link on a web page to launch the application : servlet generated jnlp file
  3. Java webstart client (1.6.0_29) starts and loads the application in a breath
  4. Because the j2se version is set to 1.4.2_12 in jnlp descriptor java webstart 1.4.2_12 is used to launch the application (loaded by 1.6.0_29)
  5. Java webstart 1.4.2_12 fails on startup claiming that it cannot find some ghost "javaws2" file

The following message is reported:

CouldNotLoadArgumentException[ Could not load specified file/URL : C:\DOCUME~1\BENOIT~1.VAT\LOCALS~1\Temp\javaws2]
    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)

Full stacktrace is:

java.io.FileNotFoundException: C:\DOCUME~1\BENOIT~1.VAT\LOCALS~1\Temp\javaws2 (File not found)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at java.io.FileInputStream.<init>(Unknown Source)
    at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(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)

  • The same error occurs when HTTPS is disabled.

Both the following HTTP headers are sent to the client by JNLP servlet :

Cache-Control : empty
Pragma : empty

These headers are necessary to prevent IE to disable caching in HTTPS mode wich prevents java webstart to find the loaded jnlp file (because it is not cached).

  • Mime-type is set to : application/x-java-jnlp-file

  • What I do not understand is why java 1.4.2_12 cannot find the jnlp file loaded by JWS 1.6.0_29 ?

Thanks for reading.

解决方案

@Andrew : Thank you for your interest.

Here comes my conclusions on that issue.

In a nutshell : Always set the href attribute in the the jnlp tag !

<jnlp spec="1.0+" codebase="htt://myhost/codebase" href="mustSetThisAbsolutelyForJWS-1.4.2_12.jnlp">
...
</jnlp>

Multiple HTTP debug sessions have shown that :

Scenario 1: href attribute is left empty and JNLP files are associated with JWS 1.6 on the client

  1. User clicks a jnlp link, JNLP file is downloaded and cached by browser.
  2. JWS 1.6.0_29 starts up then read the downloaded JNLP file.
  3. JWS 1.6.0_29 downloads all JAR files and then switches to JWS 1.4.2_12.
  4. JWS 1.4.2_12 starts up and then obviously read the JNLP file in its turn.
  5. JWS 1.4.2_12 tries to retrieve the JNLP file pointed by the href attribute.
  6. Since href is empty, JWS reports "Could not load specified file/URL : C:\DOCUME~1\BENOIT~1.VAT\LOCALS~1\Temp\javaws2". (As a side note, ghost javaws2 is sometimes named javaws10 or similar)

Please note : When using JWS 1.4 or 1.5 with this scenario, the application WILL start. The issue only appears when JWS 1.6 is used to run a 1.4.2_12 application. JWS 1.5 and 1.6 do not fail when no href attribute is set. Instead they simply use the JNLP as is, check the JAR updates and then launch the application.

Scenario 2: href attribute is set with a proper value and JNLP files are associated with JWS 1.6 on the client

  1. User clicks a jnlp link, JNLP file is downloaded and cached by browser.
  2. JWS 1.6.0_29 starts up then read the downloaded JNLP file.
  3. JWS 1.6.0_29 downloads all JAR files and then switches to JWS 1.4.2_12.
  4. JWS 1.4.2_12 starts up and then obviously read the JNLP file in its turn.
  5. JWS 1.4.2_12 tries to retrieve the JNLP file pointed by the href attribute.
  6. JWS 1.4.2_12 downloads the JNLP pointed by the href attribute.
  7. JWS 1.4.2_12 downloads all JNLP JAR files referenced in the freshly downloaded JNLP file.
  8. JWS 1.4.2_12 launches the application correctly.

It's been a major pain in the neck for me and took me days to figures this out. Hope this will help someone one day.

这篇关于FileNotFoundException 通过 HTTPS 使用 java webstart 1.6 启动 1.4.2 webstart 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆