2012-08-10 54 views
1

我使用的Grails Groovy和資源插件配置。 我有這樣的場景:資源插件提供了有關文件錯誤刪除?

  • 我有一個產品,它具有多種圖像。

  • 管理員可以刪除任何圖像。

邏輯是,當管理員點擊「刪除」時,我從文件系統中刪除文件(及其縮略文件)。

整個過程平穩運行,但經過一段時間(5-6分鐘)後,當資源插件再次刷新其資源時,它會拋出一個錯誤,提示「某些模塊依賴於資源[path/to/file ]但該文件未找到「。

堆棧跟蹤如下:

2012-08-10 12:49:41,159 [http-8080-2] ERROR errors.GrailsExceptionResolver - Exception occurred when processing request: [GET]/
Stacktrace follows: 
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <r:layoutResources>: Module [[email protected]@__] depends on resource [/images/product/p312roduct/original/Candle_4.jpg] but the file cannot be found at /home/desktop2/finalWorkspace3/ds/grails-app/views/layouts/main.gsp:13 
    at home_desktop2_finalWorkspace3_ds_grails_app_views_layouts_main_gsp$_run_closure1.doCall(main.gsp:13) 
    at home_desktop2_finalWorkspace3_ds_grails_app_views_layouts_main_gsp$_run_closure1.doCall(main.gsp) 
    at home_desktop2_finalWorkspace3_ds_grails_app_views_layouts_main_gsp.run(main.gsp:17) 
    at org.grails.plugin.resource.DevModeSanityFilter.doFilter(DevModeSanityFilter.groovy:44) 
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:197) 
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:171) 
    at java.lang.Thread.run(Thread.java:679) 
Caused by: java.lang.IllegalArgumentException: Module [[email protected]@__] depends on resource [/images/product/p312roduct/original/Candle_4.jpg] but the file cannot be found 
    at org.grails.plugin.resource.ResourceTagLib$_closure8.doCall(ResourceTagLib.groovy:463) 
    at org.grails.plugin.resource.ResourceTagLib.invokeMethod(ResourceTagLib.groovy) 
    at org.grails.plugin.resource.ResourceTagLib$_closure6.doCall(ResourceTagLib.groovy:387) 
    ... 7 more 
2012-08-10 12:49:41,172 [http-8080-2] ERROR pages.GroovyPagesServlet - Error processing GSP: Error executing tag <r:layoutResources>: Module [[email protected]@__] depends on resource [/images/product/p312roduct/original/Candle_4.jpg] but the file cannot be found at /home/desktop2/finalWorkspace3/ds/grails-app/views/layouts/main.gsp:13 
org.codehaus.groovy.grails.web.taglib.exceptions.GrailsTagException: Error executing tag <r:layoutResources>: Module [[email protected]@__] depends on resource [/images/product/p312roduct/original/Candle_4.jpg] but the file cannot be found at /home/desktop2/finalWorkspace3/ds/grails-app/views/layouts/main.gsp:13 
    at home_desktop2_finalWorkspace3_ds_grails_app_views_layouts_main_gsp$_run_closure1.doCall(main.gsp:13) 
    at home_desktop2_finalWorkspace3_ds_grails_app_views_layouts_main_gsp$_run_closure1.doCall(main.gsp) 
    at home_desktop2_finalWorkspace3_ds_grails_app_views_layouts_main_gsp.run(main.gsp:17) 
    at org.grails.plugin.resource.DevModeSanityFilter.doFilter(DevModeSanityFilter.groovy:44) 
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:197) 
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:171) 
    at java.lang.Thread.run(Thread.java:679) 
Caused by: java.lang.IllegalArgumentException: Module [[email protected]@__] depends on resource [/images/product/p312roduct/original/Candle_4.jpg] but the file cannot be found 
    at org.grails.plugin.resource.ResourceTagLib$_closure8.doCall(ResourceTagLib.groovy:463) 
    at org.grails.plugin.resource.ResourceTagLib.invokeMethod(ResourceTagLib.groovy) 
    at org.grails.plugin.resource.ResourceTagLib$_closure6.doCall(ResourceTagLib.groovy:387) 
    ... 7 more 

回答

3

資源插件預計,在模塊底層文件不會改變。此外,正被連接到直接由應用程序的任何靜態的資產(而不是通過一個模塊或<克:資源>標記),被認爲是ad-hoc,並加入作爲模塊的資源的上下文。這使得即使是這些「遺留」資產也能被資源插件縮小,編譯,緩存等。

如果您正在使用的文件系統,提供你的這些有點動態資產,你最好從資源插件的Ad-Hoc處理中排除。設置配置標誌grails.resources.adhoc.excludes排除任何目錄您在存儲這些資產。

+0

得到它..感謝 – 2012-08-13 07:02:30

+0

你是怎麼解決的呢? @AtharvaJohri? – 2017-03-10 06:40:10