Grails - 创建和映射视图时出错

时间:2013-12-18 16:34:51

标签: grails grails-2.0

我创建了一个名为signIn.gsp的视图。我把它放在URLMapping.groovy中:

class UrlMappings {

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

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

我还将其添加到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']
]

然而,在运行我的应用程序时,我得到:

|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

为什么会出现此错误?我真的很了解你的答案!

1 个答案:

答案 0 :(得分:5)

您需要在映射中使用正斜杠:

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