我是 Grails 的新手,我正在拼命尝试让 Spring Security 插件运行。我将以下行添加到我的项目中BuildConfig.groovy
:
plugins{
...
compile ":spring-security-core:1.2.7.3"
...
}
然后我尝试通过install-plugin
命令安装插件。无论我选择哪种方式,我都无法启动项目,因为我已经运行了s2-quickstart
脚本(它创建了 Spring Security 域类和控制器)。
我使用 PostgreSQL 作为数据库并在 Windows 7 上运行 Groovy/Grails Tool Suite,Grails 版本为 2.2.1。
这是错误消息:
| Loading Grails 2.2.1
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 7 source files.....
| Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
| Error 2013-03-29 22:15:17,677 [localhost-startStop-1] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'instanceTagLibraryApi': 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.TagLibraryApi.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': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.codehaus.groovy.grails.web.mapping.LinkGenerator org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib.linkGenerator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
Message: Error creating bean with name 'instanceTagLibraryApi': 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.TagLibraryApi.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': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.codehaus.groovy.grails.web.mapping.LinkGenerator org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib.linkGenerator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
Line | Method
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | 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.TagLibraryApi.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': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.codehaus.groovy.grails.web.mapping.LinkGenerator org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib.linkGenerator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | 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': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.codehaus.groovy.grails.web.mapping.LinkGenerator org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib.linkGenerator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | 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': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.codehaus.groovy.grails.web.mapping.LinkGenerator org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib.linkGenerator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Could not autowire field: private org.codehaus.groovy.grails.web.mapping.LinkGenerator org.codehaus.groovy.grails.plugins.web.taglib.ApplicationTagLib.linkGenerator; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'grailsLinkGenerator': Post-processing failed of bean type [class org.codehaus.groovy.grails.web.mapping.CachingLinkGenerator] failed; nested exception is java.lang.ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
Caused by ClassCastException: com.sun.proxy.$Proxy26 cannot be cast to java.lang.annotation.Annotation
->> 334 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 166 | run in java.util.concurrent.FutureTask
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 615 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run . . . in java.lang.Thread
编辑:
使用运行应用程序run-app --verbose --stacktrace
会导致服务器成功启动,但该过程不会在后台完成。片刻之后,服务器关闭并出现错误:
run-app --verbose --stacktrace encountered a problem
timelimit was exceeded.
编辑2:
grails -noreload run-app
然后grails clean
是grails run-app
两者都会导致服务器正常启动,但服务器会在短时间内关闭(正如我在第一次编辑中解释的那样):
grails -noreload run-app encountered a problem
当我删除$USER/.grails/
.
有关此错误的信息是控制台输出的副本:
| Loading Grails 2.2.1
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application....
| Compiling 1 source files
[groovyc] Compiling 1 source file to C:\Grails\test\target\classes
| Compiling 1 source files.....
| Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
| Server running. Browse to http://localhost:9000/test