Java Webstart 间歇性 JAR 不更新

发布于 2024-08-19 12:35:48 字数 1784 浏览 11 评论 0 原文

我们使用 java Webstart 在我们的 Intranet 上部署 java 应用程序。该应用程序经常收到更新。有时,在我们更新 Web 服务器上的 JAR/WAR(时间戳已更改)后,用户会从桌面图标启动应用程序,并且 Java Webstart 将启动旧版本而不是下载新版本。

这是我们的 JNLP 的粘贴,您可以看到脱机允许已打开,但始终更新检查和策略始终。此外,下载标志也很迫切。根据我的理解,这些选项应该始终导致根据服务器上的时间戳检查缓存并下载 JAR 文件。

我开始对 Webstart 感到沮丧!有人见过类似的问题吗?有什么解决办法吗?我厌倦了每第三次或第五次更新就引导人们手动清除他们的网络启动缓存。

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="1.0+" codebase="$$codebase" href="$$name">
  <information>
    <title>TITLE</title>

    <vendor>VENDOR</vendor>

    <description>Our Utility Application</description>

    <description kind="short">Our Utility Application PRD</description>
    <icon href="images/util_icon.png" height="64" width="64"/>
    <offline-allowed/>
    <shortcut online="true">
      <desktop />
      <menu submenu="Utility Apps"/>
    </shortcut>
  </information>

  <security>
     <all-permissions />
  </security>

  <update check="always" policy="always" />

  <resources>
    <!-- requires 1.6+ -->
    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-ea" initial-heap-size="128m" max-heap-size="512m" />

    <!-- application code, download jar before we start. -->
    <jar href="OurUpdatedJarName.jar" main="true" download="eager" />

    <property name="configfile" value="updatedJarName.config" />
  </resources>

  <application-desc main-class="main.Client">
    <argument>-D</argument> 
  </application-desc>
</jnlp>

We use java Webstart to deploy a java application on our intranet. The application receives frequent updates. Once in awhile a user will launch the application from their desktop icon after we have updated the JARs / WAR on the webserver (timestamp changed) and Java Webstart will launch the old version instead of downloading a new one.

Here is a paste of our JNLP, as you can see offline-allowed is on, but update check always and policy always. Also, download flag is eager. From my understanding these options should always result in a check of cache against timestamp on server and a download of the JAR file.

I'm starting to get frustrated with Webstart! Has anyone seen similiar problems? Any solutions? I'm getting sick of walking people through clearing their webstart cache manually every third or fifth update.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE jnlp PUBLIC "-//Sun Microsystems, Inc//DTD JNLP Descriptor 6.0//EN" "http://java.sun.com/dtd/JNLP-6.0.dtd">
<jnlp spec="1.0+" codebase="$codebase" href="$name">
  <information>
    <title>TITLE</title>

    <vendor>VENDOR</vendor>

    <description>Our Utility Application</description>

    <description kind="short">Our Utility Application PRD</description>
    <icon href="images/util_icon.png" height="64" width="64"/>
    <offline-allowed/>
    <shortcut online="true">
      <desktop />
      <menu submenu="Utility Apps"/>
    </shortcut>
  </information>

  <security>
     <all-permissions />
  </security>

  <update check="always" policy="always" />

  <resources>
    <!-- requires 1.6+ -->
    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-ea" initial-heap-size="128m" max-heap-size="512m" />

    <!-- application code, download jar before we start. -->
    <jar href="OurUpdatedJarName.jar" main="true" download="eager" />

    <property name="configfile" value="updatedJarName.config" />
  </resources>

  <application-desc main-class="main.Client">
    <argument>-D</argument> 
  </application-desc>
</jnlp>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

习惯那些不曾习惯的习惯 2024-08-26 12:35:49

这个问题是由 offline-allowed 标签引起的。

按照 JNLP 规范

如果离线指定 -allowed 时,Java Web Start 还将检查是否有可用更新。但是,如果应用程序已下载,则检查将在几秒钟后超时,在这种情况下,将启动缓存的应用程序。如果服务器连接速度相当快,通常会运行应用程序的最新版本,但不能保证。但是,该应用程序可以离线运行。

this problem is caused by offline-allowed tag.

Per JNLP spec

If offline-allowed is specified, Java Web Start will also check to see if an update is available. However, if the application is already downloaded the check will timeout after a few seconds, in which case the cached application will be launched instead. Given a reasonably fast server connection, the latest version of the application will usually be run, but it is not guaranteed. The application, however, can be run offline.

離人涙 2024-08-26 12:35:49

我们已在十几个国家分发了 java web start 应用程序,当我们发现该应用程序未正确更新时,这是因为县网或用户计算机的网络设置(主要是代理)配置错误。在我们位于西班牙的中央办公室,java web start 始终工作正常。

we have distributed java web start applications over a dozen countries and when we have found that the application wasn't updating correctly it was for a miss-configuration of the county net, or in the network settings of user computer, mostly the proxy. In our central officines in spain java web start allways work ok.

み青杉依旧 2024-08-26 12:35:49

我一直在使用 java webstart nextx.jar 克隆。我将未更新 JAR 问题追溯到 URLConnection.getLastUpdated() 方法的使用。由于它使用HEAD方法来获取文件名的lastUpdated,这就是为什么有时由于getLastUpdated()的缓存而无法下载的原因。由于 webstart 有缺陷,我们决定使用自己的方法来刷新应用程序。

I've been using the java webstart nextx.jar clone. I traced my not updating JAR issue to the use of the URLConnection.getLastUpdated() method. Since it uses the HEAD method to get the lastUpdated of the filename, this is the reason why sometimes it does not download due to caching of the getLastUpdated(). We decided to use our own method of refreshing our application as webstart is flawed.

睡美人的小仙女 2024-08-26 12:35:49

我遇到这个问题只是因为我没有让应用程序打开足够的时间来完成更新。

如果您在 JNLP 中有此选项:update check="background",请在关闭应用程序之前等待一段时间,以便更新(在后台运行)完成。

I had this problem just because I didn't let the app opened time enough to complete the update.

If you have this option: update check="background" in your JNLP, wait some time before close the application in order to allow the update (that is running on background) finish.

Hello爱情风 2024-08-26 12:35:48

您可能已经解决了问题 - 但 jnlp spec="1.0+" - 仅在 jnlp spec 6.0+ 之后才支持该元素。可能这就是您更新失败的原因之一。

You might have solved the issue - But jnlp spec="1.0+" - The element is supported only after jnlp spec 6.0+. Probably thats is one of the reasons for your updates failing.

浅浅 2024-08-26 12:35:48

假设客户端 JRE 是最新的,您可以按照此 。 sun.com/thread.jspa?threadID=5324737" rel="nofollow noreferrer">线程 并在 JNLP 语法 文档。

Assuming the client JREs are up to date, you might try <update check="timeout" policy="always"/> as suggested in this thread and described in the JNLP syntax documentation.

海之角 2024-08-26 12:35:48

我遇到了与您相同的问题,并通过执行以下操作解决了该问题:

  1. 更改

  2. 将 $VERSION 放入

我们会自动更新 $每个部署的版本。

我知道这是一个丑陋的解决方案,但它每次都对我们有用。

I had the same issues as yours and solved it by doing the following:

  1. Change

    <jar href="OurUpdatedJarName.jar" ...

    to

    <jar href="OurUpdatedJarName-$VERSION.jar" ...

  2. Put $VERSION into the <a href="foo-$VERSION.jnlp">Run</a>

We automatically update $VERSION for every deployment.

I know it's an ugly solution but it's one that works for us everytime.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文