【问题标题】:Missing resources for grails bootstrap file upload plugin?缺少 grails 引导文件上传插件的资源?
【发布时间】:2014-06-26 21:32:40
【问题描述】:

我正在尝试在我的 grails 应用程序 (http://grails.org/plugin/bootstrap-file-upload) 中使用 grails 引导文件上传插件。

我的 grails 版本是 2.2.1。插件版本为 2.1.2。插件安装成功。我还安装了 twitter-bootstrap -3.1.1.3 插件。我正在尝试使用上传插件的 UI 风格。需要包含哪些资源。插件的文档没有谈论它。

目前我包括以下内容。

<r:require module="bootstrap"/>
<r:require module="bootstrap-file-upload"/>

但是我收到以下错误。

java.lang.RuntimeException: It looks like you are missing some calls to the r:layoutResources tag. After rendering your page the following have not been rendered: [defer]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
    at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
    at org.grails.plugin.resource.DevModeSanityFilter.doFilter(DevModeSanityFilter.groovy:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:

BuildConfig.groovy

grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.target.level = 1.7
grails.project.source.level = 1.7
grails.project.dependency.resolution = {
    // inherit Grails' default dependencies
    inherits("global") {
        // specify dependency exclusions here; for example, uncomment this to disable ehcache:
        // excludes 'ehcache'
    }
    log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
    checksums true // Whether to verify checksums on resolve
    legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

    repositories {
        inherits false // Whether to inherit repository definitions from plugins
        grailsPlugins()
        grailsHome()
        mavenRepo 'http://nexusserver/nexus/content/groups/public/'
    }

    dependencies {
        //mysql
        provided 'mysql:mysql-connector-java:5.1.16'
        //joda
        compile "joda-time:joda-time:2.1"
    }

    plugins {
        compile ":hibernate:$grailsVersion"
        compile ":resources:1.1.6"
        compile ":zipped-resources:1.0"
        compile ':cache-headers:1.1.6'
        //compile ":cached-resources:1.0"
        //compile ":yui-minify-resources:0.1.5"
        compile ':cache:1.1.6'
        compile ':spring-security-core:1.2.7.3'
        compile ':spring-security-ldap:1.0.6'
        compile ":jquery:1.10.2"
        compile ":jquery-ui:1.10.3"
        compile ":bootstrap-file-upload:2.1.2"
        compile ":excel-import:1.0.0"
        compile ":twitter-bootstrap:3.1.1.3"

        //target
        build ":tomcat:$grailsVersion"
    }
}

有人知道如何解决这个问题吗?

【问题讨论】:

  • 请发布您的 BuildConfig.groovy 内容。
  • 添加了 BuildConfig.groovy 内容

标签: jquery twitter-bootstrap grails jquery-file-upload


【解决方案1】:

请仔细检查您的布局文件(默认为 main.gsp)是否有两个 &lt;r:layoutResources/&gt; 标签,一个在 &lt;head&gt; 部分,一个在 &lt;body&gt; 部分的末尾。

【讨论】:

  • 当我删除问题中提到的插件时,错误消失了。
猜你喜欢
  • 1970-01-01
  • 2014-03-17
  • 1970-01-01
  • 2015-10-04
  • 1970-01-01
  • 2015-12-16
  • 2012-02-18
  • 2012-02-23
  • 1970-01-01
相关资源
最近更新 更多