Grails 2.4 ClassNotFoundException:Sitemesh GrailsPageFilter [英] Grails 2.4 ClassNotFoundException: Sitemesh GrailsPageFilter

查看:73
本文介绍了Grails 2.4 ClassNotFoundException:Sitemesh GrailsPageFilter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请注意:该问题几乎与,但是在我这里有一些不同之处记住,值得把它作为一个单独的问题来问:

Please note: This question is almost a duplicate to this one titled "resource plugin error when upgrading from grails 2.3.8 2.4", however a few things are different that, in my mind, make it worthy of asking it as a separate question:

  • 在该问题中,问题和任何答案均未解释为什么发生此错误,除了说明所使用的插件不再是用于加载sitemesh的官方Grails插件
  • 最重要的是:在该问题中,从来没有一个可接受的答案或原始海报上的任何关于最终解决方案的验证.我不会那样做.
  • In that question, neither the question nor any answers explain why this error is occurring, other than stating that the plugin being used was no longer the official Grails plugin for loading sitemesh
  • MOST IMPORTANTLY: In that question, there was never an accepted answer or any verification from the original poster about what the final solution was. I won't do that.

所以,我要求您在作假之前,请先关闭我的位置,向我指出在其他问题中提供了 exact 解决方案的地方,该解决方案也将适用于我的确切的情况.如果您不能这样做,请不要关闭/关闭该问题!

So, I ask that before you down/closevote this as a dupe, to please point out to me where in that other question the exact solution was provided that will also apply to my exact situation. If you can't do that, please don't down/closevote this question!

我正在将Grails 2.3.6应用程序升级到Grails 2.4.4.当我执行 run-app 时,我得到:

I am upgrading a Grails 2.3.6 app to Grails 2.4.4. When I do a run-app I get:

Error |
2015-03-05 14:42:44,257 [localhost-startStop-1] ERROR [localhost].[/myapp]  - Exception starting filter sitemesh
java.lang.ClassNotFoundException: org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter
    at org.grails.plugins.tomcat.ParentDelegatingClassLoader.findClass(ParentDelegatingClassLoader.java:59)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4809)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5485)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Error |
2015-03-05 14:42:44,268 [localhost-startStop-1] ERROR core.StandardContext  - Error filterStart
Error |
2015-03-05 14:42:44,270 [localhost-startStop-1] ERROR core.StandardContext  - Context [/myapp] startup failed due to previous errors

这是我的 BuildConfig 的插件部分:

plugins {
    runtime ":resources:1.2.14"
    compile 'org.grails.plugins:gson:1.1.4'
    compile ":standalone:1.3"
    build ":release:3.0.1"
    runtime ":cached-resources:1.0"
    compile ":cache-headers:1.1.7"
    compile ":yammer-metrics:3.0.1-2"
    compile ":scaffolding:2.1.2"
    compile ':cache:1.1.1'
    runtime ":hibernate:3.6.10.8" // or ":hibernate4:4.3.1.1"
    runtime ":database-migration:1.3.8"
    runtime ":jquery:1.11.1"
    test(":geb:$gebVersion")
    test(":spock:0.7") {
        exclude "spock-grails-support"
    }
}

如果可以避免,我不想使用资产管道.到目前为止,我读过的所有内容都指出,使用 resources:1.2.14 可使Grails 2.4.4应用程序与资源插件兼容.

I do not want to use asset-pipeline if it can be avoided. Everything I've read so far states that using resources:1.2.14 makes a Grails 2.4.4 app compatible with the resources plugin.

有人可以解释使用Sitemesh的Grails 2.4.4方式,以便使此错误消失吗?如果不可避免地使用 asset-pipeline ,使用它我需要对我的项目进行哪些确切的转换.我确实尝试用最新的资产管道插件替换资源插件,如下所示:

Can someone explain the Grails 2.4.4 way of using sitemesh so that this error goes away? If using asset-pipeline is unavoidable, what are the exact conversions I would need to make to my project to use it. I did try replacing the resource plugin with the latest asset pipeline plugin like so:

plugins {
    ...
    //runtime ":resources:1.2.14"
    compile ":asset-pipeline:1.8.3"
    ...
}

但是错误并没有消失.有想法吗?

But the error didn't go away. Thoughts?

推荐答案

我不确定为什么您不能使用Grails 2.4.4中的资源插件,但是我的建议是使用资产管道,因为它比旧的 resources 插件要优越得多.这是一篇很好的文章,解释了原因(来自插件作者)以及如何:

I'm not sure why you wouldn't be able to use the resources plugin in Grails 2.4.4, but my recommendation would be to use the asset-pipeline, as it is far superior to the older resources plugin. Here is a very good article explaining why (from the author of the plugin), and how:

第二眼,我认为这可能是2.3.x版本中不兼容的 web.xml 的问题.其中具有以下内容:

On second look, I believe this may be an issue with an incompatible web.xml from version 2.3.x. which had the following:

<filter>
    <filter-name>sitemesh</filter-name>
    <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
</filter>

这里是新2.4.x web.xml 文件的链接:

Here is a link to the new 2.4.x web.xml file:

这篇关于Grails 2.4 ClassNotFoundException:Sitemesh GrailsPageFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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