Java WS 应用程序偶尔忽略参数 [英] Java WS application ignoring arguments sporadically

查看:26
本文介绍了Java WS 应用程序偶尔忽略参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近组装了一个 JWS 应用程序,它从动态创建的 JNLP 文件中获取它的参数(详细信息可以在 此处).除了应用程序忽略我的系统(linux x86_64)上的参数(启动时没有加载指定的数字)之外,一切都很好.然而,JWS 应用程序似乎与我同事的 win_64 机器上的预期完全一样.这很有趣,因为我无法在另一个类似的 win_64 上复制他的成功.

I have recently put together a JWS application which gets it's argument from a dynamically created JNLP file (details can be found here). It's all good except the application ignores the argument (starts without loading the specified number) on my system (linux x86_64). It seems however that the JWS application exactly as intended on the win_64 machine of a colleague of mine. This is rather interesting as I couldn't replicate his success on another similar win_64.

为了让事情更令人兴奋,当我下载 JNLP 文件并在终端上通过 javaws 运行它时,相同的 JWS 应用程序工作得很好(换句话说,不会忽略参数).

To make things more exciting, the same JWS application works just fine (in other words, doesn't ignore the argument) when I download the JNLP file and run it by javaws on the terminal.

我比较了 java.policy 和 javaws.policy 文件,没有区别.JNLP 文件清楚地给出了所有权限,并且 jar 文件的签名都很好(这不可能是问题的根源,否则应用程序将无法启动,对吧?).

I have compared the java.policy and javaws.policy files and there are no differences. The JNLP file clearly gives all-permissions, and the jar files are signed all fine (which can't be the source of the problem otherwise the application wouldn't start, right?).

问题 1: 那么这个问题取决于什么?

Question 1: So what could this problem depend on?

我只是设法从一台新的(在这个特殊意义上)win32 机器上得到了正确的响应,没有任何明显的 java 更新.问题 2 : 是否有 javaws 的日志文件,我可以在上面检查发生了什么,或者,我是否可以将启动详细信息发送到控制台,以便我可以创建自己的自定义日志?em>

I just managed to get proper response from a new (in this particular sense) win32 machine, without any obvious java update. Question 2 : Is there a log file for javaws on which I can check what happens, or alternatively, can I verbose the launch to a console so I can create my own custom logs?

编辑 2: 顺便说一句,我忘了提到我也在 Oracle 论坛,我最初可能应该提到它,因为它在那里被礼貌地指出.无论如何,线程上有关于 JNLP 文件的更多信息,以防万一.

Edit 2: By the way, I have forgotten to mention that I have also posted this question at the Oracle forums, which I should have perhaps mentioned initially as it was politely pointed out there. Anyways, there is more information on the JNLP file there on the thread, in case it might be relevant.

编辑 3: 在生成 JNLP 文件时,我开始认为问题可能源于 标记的属性.最初的 jnlp 标签看起来像这样:

Edit 3: I came to think that the problem could be originating from the properties of the <jnlp> tag, upon generating the JNLP file. Originally the jnlp tag looked like this like this:

<jnlp spec="1.0+" codebase="http://mydomain/myapp/" 
    href="my.jnlp">

问题在于代码库中声明的目录中没有 my.jnlp,而是 JNLP 代码由 cgi-bin 目录中的 Perl 脚本动态创建并作为输出返回流(我认为).所以我编辑了脚本以生成带有以下标记的 JNLP:

The problem with this is the fact that there is no my.jnlp in the the directory declared in the codebase, instead the JNLP code is created on the fly by a Perl script in the cgi-bin directory and returned as an output stream (I think). So I edited the script to generate the JNLP with the following tag:

<jnlp spec="1.0+" codebase="http://mydomain/myapp/" 
    href="http://mydomain/cgi-bin/my.jnlp">

这个实验的结果:这次连GUI都没有启动...我在 Oracle 论坛上找到了一个相关主题,其中建议以下列方式定义 href 属性:

The result of this experiment: not even the GUI started this time... I have found a relevant thread on Oracle forums, where it was advised to define the href property in the following fashion:

href="script.jsp?<%=request.getQueryString()%>">

不幸的是,这并没有解决我的问题.

which unfortunately doesn't solve my problem.

问题 3: 这种修改是否也适用于我的情况?这种情况怎么办?如果对可能导致问题的原因没有任何见解,我将不胜感激,因为我现在的工作真的陷入了僵局

Question 3: Could this modification be applicable to my situation as well? In that case how? If not any insights on what might be causing the problem would be seriously appreciated as I am really at a stalemate on my work right now

推荐答案

在与 JNLP 文件语法和我的 CGI 脚本搏斗两周后,我想我终于找到了问题的症结所在.我在这里记录了这一点(冒着装作回答我自己的问题的风险)以防其他人遇到同样的问题.

After two weeks of wrestling with the JNLP file syntax and my CGI script, I think I finally found the crux of the problem. I am noting this down here (at the risk of looking pretentious enough to answer my own question) in case somebody else runs into the same problem.

<jnlp> 标签的 href 属性,在我的例子中显然是不必要的,当删除应用程序时,应用程序开始在 linux 和 win 系统上按预期工作.我不是 100% 确定这是否是确切原因,但我的理解是,由于 jnlp 语法是从脚本生成并直接返回给用户而不是文件系统中某处的 jnlp 文件,href 属性指向错误的地方,可能会导致某种冲突,在不同的操作系统中以不同的方式处理.

The href property of the <jnlp> tag, in my case was apparently unnecessary and when removed the application started working as intended on both linux and win systems. I am not 100% sure if this is the exact reason but my understanding is that as the jnlp syntax is generated from a script and directly returned to the user instead of a jnlp file somewhere in the filesystem, the href property was pointing to a wrong place and perhaps caused some sort of a clash that is handled differently in different OS.

这篇关于Java WS 应用程序偶尔忽略参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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