Applet 停止使用 JNLP MissingFieldException <jnlp> [英] Applet stopped working with a JNLP MissingFieldException <jnlp>

查看:24
本文介绍了Applet 停止使用 JNLP MissingFieldException <jnlp>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 1/2 年前运行的小程序.现在我需要重新激活"它,但是由于未知原因它不再工作了.以下是规格:

I have an applet which was running 1/2 year ago. Now i needed to 'reactivate' it however for an unknown reason it is not working anymore. Here are the specs:

  • 基于 JNLP 的 NG Applet
  • 雄猫 7
  • JRE 1.7.0_25
  • Firefox 22 和 Chrome 28

这是我得到的错误:

MissingFieldException[ The following required field is missing from the launch file: <jnlp>]
at com.sun.javaws.jnl.XMLFormat.parse(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory._buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error while initializing manager: MissingFieldException[ The following required field is missing from the launch file: <jnlp>], bail out

到目前为止我尝试/怀疑的:

What I tried/suspected so far:

  1. 在安全更新 7u17、7u21 或 7u25 中引入了一些 oracle.但是,我尝试了从 7u25 到 7u0 的所有 JRE,但没有帮助.还尝试了 6u51 到 6u22,我确信以前确实有效.
  2. Mozilla 或 Google 引入了一些东西,以结合 java 插件来提高浏览器的安全性.尝试了各种较旧的浏览器版本 - 没有成功.但是后来我尝试了 IE10,它正在运行?!
  3. 分析了 JNLP 文件(也使用 JaNeLa),但由于它以前确实有效并且在 IE10 中有效,因此它不可能是 JNLP.该插件似乎甚至没有分析 JNLP.

有什么想法吗?

推荐答案

在这个问题上花了将近两天的时间后,我想通了,希望能帮助其他人解决这个问题.解释:

After nearly spending two days on that problem I figured it out, hopefully helping others with that. The explanation:

  1. 我的小程序在受保护的 Web 应用程序的上下文中运行,用户需要首先使用表单登录来登录.
  2. 这样做之后,会创建一个会话 cookie 并将其发送回客户端/浏览器.
  3. 自从我从 tomcat 6 切换到 tomcat 7 后,useHttpOnly 政策用于 cookie默认情况下启用,在 tomcat 7 之前的所有 tomcat 版本中都被禁用. HttpOnly 标志指示浏览器阻止从 JavaScript/插件访问这些 cookie(安全原因,例如跨站点脚本等).
  4. 现在,由于 java 插件无法访问 cookie,因此在请求 JNLP 文件时不会将其发送到服务器.
  5. 服务器返回所有未授权请求的登录页面.
  6. 最后但同样重要的是,JNLP 解析器正在寻找 <jnlp> 结构,但找不到任何 - 所以产生了上述错误.
  1. My applet runs in the context of a protected web application where a user needs to login with a form login first.
  2. After doing so, a session cookie is created and sent back to the client/browser.
  3. Since I switched from tomcat 6 to tomcat 7 the useHttpOnly policy for cookies is enabled by default which was disabled for all tomcat versions prior tomcat 7. The HttpOnly flag instructs browsers to prevent access to those cookies from JavaScript/Plugins (security reasons e.g. cross site scripting etc).
  4. Now since the java plugin couldn't access the cookie it didn't sent it to the server when requesting the JNLP file.
  5. the server returns the loginpage for all unauthorized request.
  6. Last but not least the JNLP parser was looking for the <jnlp> structure and couldn't find any - so the above error was generated.

那么如何防止这种情况发生?

So how can that be prevented?

  1. 全局禁用 tomcat 中的 useHttpOnly 标志
  2. 禁用 web 应用程序的 useHttpOnly 标志(我这样做了).为此,在您的 webappication 的 META-INF 中添加一个 context.xml 文件,其中包含以下行

现在为什么 IE10 似乎忽略 httponly 标志是一个我可以接受的悬而未决的问题;-)

Now why the IE10 seems to ignore the httponly flag is a open question i can live with ;-)

这篇关于Applet 停止使用 JNLP MissingFieldException &lt;jnlp&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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