在带有缓存插件的grails应用程序上找不到资源 [英] Resource not found on grails application with cache plugins
问题描述
我在grails应用程序中安装了缓存头(1.0.4)和缓存资源(1.0),偶尔我们会收到如下消息.
您对我们为什么收到这些消息以及如何解决它有任何线索吗?
致谢
2013-09-24 04:21:34,561 [catalina-exec-2]错误resource.ResourceMeta -CENTRALLEAD-找不到资源:/LNEjLROINsk9TKAzkAwtTxIXru6CyGZP4s5w1mybXkD.js
2013-09-24 04:21:30,030 [catalina-exec-5]错误resource.ResourceMeta -CENTRALLEAD-找不到资源:/ZCCuNwL3Y8SsQanoiqrQWpsP4q9q7JN3IDqeB4FsIve.css
我的配置如下:
////////////////////////////////////////////////////////
/////// Resources
////////////////////////////////////////////////////////
// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = [
'/images/*',
'/css/*',
'/js/*',
'/plugins/*'
]
已编辑
有些不可思议的东西. 我们最容易收到错误的图像是: http://bemdireto.com.br/static/BkSQHPEr6mihRHkVPfr5gl9Dkqxws我们还设置了配置:
grails.resources.work.dir = "/www/logs/tmp/centrallead"
并且图像存在于该文件夹中
我们有一个负载平衡器,并且所有服务器中都存在该映像
可能是清理过的资源工作目录,或者是错误的缓存.通常,当我使用缓存资源时,请执行以下操作(在 Config.groovy 中):
-
grails.resources.debug=true
:仅用于开发模式.这样一来,在开发过程中更改大量文件时,您将避免出现奇怪的缓存问题 -
grails.resources.work.dir
:为临时文件定义一个固定目录.这在生产中很重要,并且可以避免这种找不到资源的错误,因为默认值是容器的临时文件夹,并且可以由容器清除.
I have installed cache-header (1.0.4) and cached-resources (1.0) in our grails application and once in a while we receive messages like the one below.
Do you have any clue on why do we get those messages and how can we fix it?
Regards
2013-09-24 04:21:34,561 [catalina-exec-2] ERROR resource.ResourceMeta - CENTRALLEAD - Resource not found: /LNEjLROINsk9TKAzkAwtTxIXru6CyGZP4s5w1mybXkD.js
2013-09-24 04:21:30,030 [catalina-exec-5] ERROR resource.ResourceMeta - CENTRALLEAD - Resource not found: /ZCCuNwL3Y8SsQanoiqrQWpsP4q9q7JN3IDqeB4FsIve.css
My configuration looks like:
////////////////////////////////////////////////////////
/////// Resources
////////////////////////////////////////////////////////
// What URL patterns should be processed by the resources plugin
grails.resources.adhoc.patterns = [
'/images/*',
'/css/*',
'/js/*',
'/plugins/*'
]
EDITED
There is something really weird. The image that we most get the error is: http://bemdireto.com.br/static/BkSQHPEr6mihRHkVPfr5gl9Dkq02wsucDobLXxgHaao.jpg
we have also set at the config:
grails.resources.work.dir = "/www/logs/tmp/centrallead"
and the image is present at that folder
We hava a load balancer and the image is present in all servers
It can be the resources work dir that was cleaned up, or a wrong cache. Normally when I use the cached-resources I do the following (in Config.groovy):
grails.resources.debug=true
: only for development mode. With that you will avoid weird cache issues when changing a lot your files during the developmentgrails.resources.work.dir
: Define a fixed directory for the temporary files. This is important in production, and will evict this errors of resource not found, because the default is the temporary folder of your container, and it can be cleaned by the container.
这篇关于在带有缓存插件的grails应用程序上找不到资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!