【问题标题】:resource plugin error when upgrading from grails 2.3.8 2.4从 grails 2.3.8 2.4 升级时出现资源插件错误
【发布时间】:2014-07-24 04:06:17
【问题描述】:

我正在关注docs,试图将我的项目从 2.3.8 升级到 2.4,但我遇到了这些错误

localhost-startStop-1] ERROR resource.ResourceProcessor  - Unable to load resources
Message: No signature of method: groovy.util.ConfigObject.getGrailsPlugin() is applicable    
for argument types: (java.lang.String) values: [lesscss-resources]


->>    5 | run                   in BootstrapResources
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     46 | doCall                in org.grails.plugin.resource.module.ModuleDeclarationsFactory$_getModuleDeclarations_closure2
|     41 | getModuleDeclarations in org.grails.plugin.resource.module.ModuleDeclarationsFactory
|    715 | loadModules           in org.grails.plugin.resource.ResourceProcessor
|   1013 | reloadAll . . . . . . in     ''
|    166 | doCall                in ResourcesGrailsPlugin$_closure3
|    262 | run . . . . . . . . . in java.util.concurrent.FutureTask
|   1145 | runWorker             in java.util.concurrent.ThreadPoolExecutor
|    615 | run . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run                   in java.lang.Thread
Error |
2014-06-03 13:38:16,282 [localhost-startStop-1] ERROR [localhost].   [/DocumentManagementSystem]  - Exception starting filter sitemesh
Message: org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter
Line | Method
->>   59 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    425 | loadClass in java.lang.ClassLoader
|    358 | loadClass in     ''
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . in java.lang.Thread
Error |
2014-06-03 13:38:16,300 [localhost-startStop-1] ERROR core.StandardContext  - Error     filterStart
Error |

这听起来像是插件问题吗?或者我可能在文档中跳过的内容

这是我的 buildconfig 插件部分

plugins {
    // plugins for the build system only
    build ":tomcat8:8.0.5"

    // plugins for the compile step
    compile ":scaffolding:2.1.0"
    compile ':cache:1.1.6'
//      compile ":mail:1.0.5"
//      compile ":ckeditor:4.4.0.0-SNAPSHOT"
    compile ":searchable:0.6.7"
    compile ":jquery:1.11.1"
//      compile ":shiro:1.2.1"
//      compile ":resources:1.2.8"
    compile ':asset-pipeline:1.8.3'
//      compile (":nimble:0.7"){
//          
//          exclude "servlet-api"
//          
//          }

    // plugins needed at runtime but not for compilation
    runtime ":hibernate:3.6.10.15" // or ":hibernate4:4.3.5.1"
    runtime ":database-migration:1.4.0"
    runtime ":jquery:1.11.1"
    runtime ":resources:1.2.8"

新的站点网格错误

Error |
2014-06-03 14:41:32,304 [localhost-startStop-1] ERROR [localhost].[/DocumentManagementSystem]  - Exception starting filter sitemesh
Message: org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter
Line | Method
->>   61 | findClass in org.grails.plugins.tomcat.ParentDelegatingClassLoader
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    425 | loadClass in java.lang.ClassLoader
|    358 | loadClass in     ''
|    262 | run       in java.util.concurrent.FutureTask
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    744 | run . . . in java.lang.Thread
Error |

【问题讨论】:

  • 使用了哪个版本的resources插件?
  • 如果你正在使用 twitter 引导插件并将其升级到 3.1.1.3。请参阅this issue 和此commit。假设您使用的是最新版本 1.2.8 的资源插件。
  • 正在使用 1.2.8。我已经解决了这个问题,将 tomcat 更新到 8.8.0.5 并暂时删除了一些插件的使用,但现在出现“执行脚本 RunApp 时出错:java.lang.NullPointerException”
  • 你能在问题中添加BuildConfig.groovy的插件部分吗?
  • 已编辑到原始帖子中。随着我在项目中的进一步推进,我可能会完全删除 nimble 插件并切换到 Spring Security 插件,否则我会使用其中的大部分

标签: grails


【解决方案1】:

您的 web.xml 可能仍包含对站点网格过滤器的引用:

http://grails.org/doc/2.4.3/guide/upgradingFrom23.html

Sitemesh servlet 过滤器已被移除,GSP 布局功能现在由 GrailsLayoutView 处理。

将 src/templates 文件夹重命名为 src/templates-old,然后运行 ​​grails install-templates。如果您之前自定义了 web.xml,则需要编辑生成的 web.xml 以再次进行这些更改。

【讨论】:

    【解决方案2】:

    这是JqueryUiPluginResources.groovy中jQuery-ui插件的问题,如下两行:

    def appCtx = org.codehaus.groovy.grails.commons.ApplicationHolder.application.mainContext
    
    def plugin = appCtx.pluginManager.getGrailsPlugin('jquery-ui')
    

    以下提交中存在此问题的修复:https://github.com/gpc/grails-jquery-ui/pull/13

    【讨论】:

      【解决方案3】:

      正如文档中所说,您不再需要使用资源插件:

      As of Grails 2.4 the resources plugin has been replaced with the asset-pipeline
      

      现在您可以改用资产插件。 使用这个link,您可以轻松地将您的资源从 2.3.8 升级到 2.4。

      【讨论】:

      • 解释错误。对于 2.4.0 版的新 Grails 应用程序,默认情况下您会获得资产管道。这并不意味着如果您在 2.3.8 中使用资源插件,则在 2.4.0 中不能再使用它。
      • @dmahapatro 我知道,我没说你不能使用资源!我说“你不再需要使用资源插件”和“你可以使用资产插件”。我认为当您可以轻松使用资产时,为什么还要费心并尝试以您仍然可以使用资源的方式进行升级。仔细阅读我的回答!
      • 这并没有直接解决 OP 面临的问题,这是一个建议,我同意。
      猜你喜欢
      • 2014-11-12
      • 2015-08-31
      • 2015-07-08
      • 1970-01-01
      • 1970-01-01
      • 2017-03-14
      • 1970-01-01
      • 1970-01-01
      • 2012-10-31
      相关资源
      最近更新 更多