在GWT应用程序中出现错误HTTP 404(“脚本标记失败 - 无状态可用”) [英] Error HTTP 404 ("Script Tag Failure - no status available") in GWT application

查看:120
本文介绍了在GWT应用程序中出现错误HTTP 404(“脚本标记失败 - 无状态可用”)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序中,我们使用 Sencha GXT GWT 2.7



不幸的是,在弹出窗口中通常会显示以下错误: p>


下载/ path / deferredjs / SOMEGENERATEDID失败,状态为404
(Script Tag Failure - no status available)


只有在部署新版本的应用程序时才会出现这种情况。清除浏览器缓存解决了问题。



我发现这个错误发生在类 ScriptTagLoadingStrategy。 java 在GWT中。



除了每次清除浏览器缓存时,还有其他解决此问题的方法吗?

解决方案

看起来,您关于缓存的HTTP服务器配置没有正确配置为与GWT一起工作。

根据至文档




  • *。nocache。* 不应该被缓存

  • .cache。 可以安全地缓存
  • ver
    $ b

    *。nocache.js 文件是启动脚本


    此文件负责根据浏览器和区域设置(...)选择正确的应用程序版本以便为客户端加载。符合每个浏览器/语言环境的各种版本的应用程序都是< md5> .cache.html 应用程序文件。


    简而言之:引导程序文件会改变每个编译过程,并且是您的应用程序的网关。它选择加载哪个< md5> .cache。* 应用程序版本。它的名字必须是恒定的,因为你从主机页面引用它。由于< md5> .cache。* 文件的名称会随着每次源代码更改而变化(因为它的名称是其内容的MD5哈希),所以它们可以安全地缓存。因此,发生的一件事情是旧的bootstrap脚本会被缓存(并且会被加载而不是新的脚本),并且它会尝试加载应用程序的旧版本(其中一个
    code> * .cache。* files)。但是,这些文件可能已被编译/重新部署删除,因此 404


    In our application we use Sencha GXT and GWT 2.7.

    Unfortunately there's often the following error displayed in a pop-up:

    Download of /path/deferredjs/SOMEGENERATEDID failed with status 404 ("Script Tag Failure - no status available")

    It only seems to occur when a new version of the application has been deployed. Clearing the browser cache solves the problem.

    I found out that this error occurs in the class ScriptTagLoadingStrategy.java in GWT.

    Is there another way to solve this problem other than clearing the browser cache every time it occurs?

    解决方案

    It seems that your HTTP's server configuration regarding caching is not properly configured to work with GWT.

    According to the documentation:

    • *.nocache.* should not be cached
    • .cache. can be safely cached

    There's an example configuration for Apache HTTP server in the documentation too.

    The *.nocache.js file is a bootstrap script:

    This file is responsible for choosing the correct version of your application to load for your client based on their browser and locale (...). The various versions of your application compliant to each browser / locale are the <md5>.cache.html application files.

    In short: the bootstrap file changes every compile and is a "gateway" to your application. It selects which <md5>.cache.* application version to load. Its name has to be constant because you are referencing it from your host page. Since <md5>.cache.* files' names change with every source code change (because its name is its content's MD5 hash), they can be safely cached.

    So what is happening is that an old bootstrap script is cached (and loaded instead of the new one) and it's trying to load an old version of your application (one of the *.cache.* files). However, those files have been probably removed by the compilation/redeploy, hence the 404.

    这篇关于在GWT应用程序中出现错误HTTP 404(“脚本标记失败 - 无状态可用”)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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