【问题标题】:Spring Security UI and grails 2.0Spring Security UI 和 grails 2.0
【发布时间】:2012-02-01 06:22:50
【问题描述】:

我无法在 Grails 2.0 中使用 grails 安全 UI(0.1.2)。 我已经搜索了以下错误的可能原因,并且还尝试了建议的修复,但它们似乎没有工作。 我已经尝试过,覆盖 UI,我也尝试过 Grails 2.0-m2 版本。

| Error 2012-01-02 17:17:12,659 ["http-bio-8080"-exec-5] ERROR [/webdemo].[default]  - Servlet.service() for servlet [default] in context with path [/webdemo] threw exception
Message: It looks like you are missing some calls to the r:layoutResources tag. After rendering your page the following have not been rendered: [head]
   Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   908 | run     in     ''
^   619 | run . . in java.lang.Thread

以下是我的 main.gsp(为简洁起见,删除了一些代码/cmets)

<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title><g:layoutTitle default="Grails"/></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
        <link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
        <link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">
        <link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css">
        <link rel="stylesheet" href="${resource(dir: 'css', file: 'mobile.css')}" type="text/css">
        <g:layoutHead/>
        <r:layoutResources />
    </head>
    <body>
        <div id="grailsLogo" role="banner"><a href="http://grails.org"><img src="${resource(dir: 'images', file: 'grails_logo.png')}" alt="Grails"/></a></div>
        <g:layoutBody/>
        <div class="footer" role="contentinfo"></div>
        <div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading&hellip;"/></div>
        <g:javascript library="application"/>
        <r:layoutResources />
    </body>

【问题讨论】:

    标签: grails grails-plugin spring-security grails-2.0


    【解决方案1】:

    我收到了同样的消息 It looks like you are missing some calls to the r:layoutResources tag. 使用以下代码

        <g:javascript library='application' />
        <g:layoutHead/>
        <r:layoutResources />
    

    移动时固定 &lt;g:javascript/&gt; layoutHead layoutResources之间调用

        <g:layoutHead/>
              <g:javascript library='application' />
        <r:layoutResources />
    

    【讨论】:

      【解决方案2】:

      尝试删除所有 g:javascript 调用(即&lt;g:javascript library="application"/&gt;)并改为通过资源基础架构加载它。

      我在这里遇到了完全相同的问题(使用 Grails 2.0.1),这似乎解决了它。

      如果该解决方案也适用于您,您可能需要考虑提交错误报告 - 因为这至少是一个非常令人困惑的错误消息。

      【讨论】:

      • 您删除了哪些 g:javascipt 调用 - 他 springSecurityUI 插件 reqister 和 auth gsps 中的那些? (我假设是通过 s2ui-override 实现的?)你能分享一下生成的资源模块吗?
      • 在我的情况下,我已经覆盖了寄存器;我删除了 register.gsp 布局中的 g:javascript(即使它们被注释掉了),问题就消失了。
      【解决方案3】:

      &lt;head&gt; 内和&lt;/body&gt; 之前添加&lt;r:layoutResources /&gt; 标签。

      这是Grails Resources Plugin 需要的,可以在此处找到标签的更多文档http://grails-plugins.github.com/grails-resources/ref/Tags/layoutResources.html

      【讨论】:

      • 请检查我的编辑,我已经添加了我的 main.gsp 并且我已经有了这些标签。感谢您的回复
      猜你喜欢
      • 2014-10-04
      • 2012-10-19
      • 2017-10-26
      • 2015-08-12
      • 1970-01-01
      • 2016-08-12
      • 2012-09-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多