Resource not found on grails application with cache plugins

戏子无情 提交于 2020-01-07 03:42:07

问题


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


回答1:


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 development

  • grails.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.



来源:https://stackoverflow.com/questions/18983065/resource-not-found-on-grails-application-with-cache-plugins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!