9

I am not able to use grails security UI(0.1.2) with Grails 2.0. I have googled the possible causes for following error and also have tried suggested fixes but they don't seem to be working. I have already tried, overriding the UIs, I also have tried Grails 2.0-m2 version.

| 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

Following is my main.gsp (some code/comments are removed for brevity)

<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>
david
  • 2,529
  • 1
  • 34
  • 50
Sap
  • 5,197
  • 8
  • 59
  • 101

3 Answers3

9

Add <r:layoutResources /> tag inside <head> and right before </body>.

This is needed by the Grails Resources Plugin and further documentation for the tag can be found here http://grails-plugins.github.com/grails-resources/ref/Tags/layoutResources.html

Jan Wikholm
  • 1,557
  • 1
  • 10
  • 19
  • Please check my edit, I have added my main.gsp and I already have those tags in it. Thanks for a reply though – Sap Jan 03 '12 at 06:45
8

Try to remove any g:javascript calls (i.e. the <g:javascript library="application"/>) and load it via the resources infrastructure instead.

I am having the exact same problem here (with Grails 2.0.1) and this seems to resolve it.

If that solution does work for you too, you might want to consider filing a bug report - as this is at least a very confusing error message.

user569825
  • 2,369
  • 1
  • 25
  • 45
  • Which g:javascipt calls did you remove - the ones in he springSecurityUI plugin reqister and auth gsps? (By doing s2ui-override, I assume?) Could you share the resulting resources module? – Wayne Jan 24 '12 at 22:57
  • In my situation, I had overridden register; I removed the g:javascript in the register.gsp layout (even though they were commented out), and the problem went away. – Stevi Deter Mar 05 '12 at 04:45
0

I was having getting the same message It looks like you are missing some calls to the r:layoutResources tag. with following code

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

Fixed when moved <g:javascript/> call between layoutHead and layoutResources

    <g:layoutHead/>
          <g:javascript library='application' />
    <r:layoutResources />
prayagupa
  • 30,204
  • 14
  • 155
  • 192