Grails - Error creating and mapping a view

点点圈 提交于 2019-12-23 12:25:05

问题


I have created a view with the name signIn.gsp. I put it into the URLMapping.groovy with:

class UrlMappings {

    static mappings = {
        "/$controller/$action?/$id?(.${format})?"{
            constraints {
                // apply constraints here
            }
        }

        "/"(view:"/index")
        "signIn"(view:'/signIn')
        "500"(view:'/error')
    }
}

I also added it to the spring security part in the Config.groovy:

// Added by the Spring Security Core plugin:
grails.plugin.springsecurity.userLookup.userDomainClassName = 'com.testApplication.secureApplication.Person'
grails.plugin.springsecurity.userLookup.authorityJoinClassName = 'com.testApplication.secureApplication.PersonRole'
grails.plugin.springsecurity.authority.className = 'com.testApplication.secureApplication.Role'
grails.plugin.springsecurity.controllerAnnotations.staticRules = [
    '/':                              ['permitAll'],
    '/index':                         ['permitAll'],
    '/signIn':                         ['permitAll'],
    '/index.gsp':                     ['permitAll'],
    '/**/js/**':                      ['permitAll'],
    '/**/css/**':                     ['permitAll'],
    '/**/images/**':                  ['permitAll'],
    '/**/favicon.ico':                ['permitAll']
]

However, when running my application I get:

|Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Error |
2013-12-18 17:20:00,298 [localhost-startStop-1] ERROR context.GrailsContextLoader  - Error initializing the application: Error creating bean with name 'grails.plugin.databasemigration.DbdocController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instanceControllerTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setGspTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
Message: Error creating bean with name 'grails.plugin.databasemigration.DbdocController': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'instanceControllerTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setGspTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
    Line | Method
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'instanceControllerTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setGspTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.ControllerTagLibraryApi.setGspTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'grailsUrlMappingsHolder': Cannot resolve reference to bean 'urlMappingsTargetSource' while setting bean property 'targetSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'urlMappingsTargetSource': Cannot resolve reference to bean 'org.grails.internal.URL_MAPPINGS_HOLDER' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'org.grails.internal.URL_MAPPINGS_HOLDER': Invocation of init method failed; nested exception is groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>  334 | innerRun  in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    166 | run       in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run . . . in java.lang.Thread
Caused by MissingMethodException: No signature of method: org.codehaus.groovy.grails.web.mapping.DefaultUrlMappingEvaluator$UrlMappingBuilder.signIn() is applicable for argument types: (java.util.LinkedHashMap) values: [[view:/signIn]]
Possible solutions: find(), find(groovy.lang.Closure)
->>   11 | doCall    in UrlMappings$__clinit__closure1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|    334 | innerRun  in java.util.concurrent.FutureTask$Sync
|    166 | run . . . in java.util.concurrent.FutureTask
|   1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    603 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^    722 | run       in java.lang.Thread
Error |
Forked Grails VM exited with error

Why do I get this error? I really appreicate your answer!


回答1:


You need a forward slash in your mapping:

"/signIn"(view: '/signIn')


来源:https://stackoverflow.com/questions/20663522/grails-error-creating-and-mapping-a-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!