【问题标题】:Fatal error during compilation org.springframework.beans.factory.BeanDefinitionStoreException编译时出现致命错误 org.springframework.beans.factory.BeanDefinitionStoreException
【发布时间】:2014-11-18 16:52:19
【问题描述】:

我有一个运行良好的 grails 2.2.4 应用程序。但是,当我尝试将 spring-security-ui 插件集成到应用程序中时,它不会启动。我将以下内容添加到我的BuilConfig.groovy

compile ":spring-security-ui:1.0-RC2"

在此之后,当我尝试运行应用程序时,我得到以下信息:

> You currently already have a version of the plugin installed [spring-security-core-1.2.7.3]. Do you want to update to [spring-security-core-2.0-RC3]? [y,n] n
n
| Plugin spring-security-core-2.0-RC3 install aborted
> You currently already have a version of the plugin installed [jquery-1.7.2]. Do you want to update to [jquery-1.11.1]? [y,n] n
n
| Plugin jquery-1.11.1 install aborted
> You currently already have a version of the plugin installed [jquery-ui-1.8.24]. Do you want to update to [jquery-ui-1.10.3]? [y,n] n
n
| Plugin jquery-ui-1.10.3 install aborted
| Plugin jquery-ui-1.10.3 install aborted.
| Error Fatal error during compilation org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: URL 
[jar:file:/Users/birdy/.grails/ivy-cache/org.grails/grails-core/jars/grails-core-2.2.4.jar!/org/codehaus/groovy/grails/compiler/DirectoryWatcher$FileChangeListener.class]; 
nested exception is java.lang.NoClassDefFoundError: org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor (Use --stacktrace to see the full trace)

当我使用 --stacktrace 选项时,我得到以下堆栈跟踪:

    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:290)
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)
    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.scan(ClassPathBeanDefinitionScanner.java:220)
    at _GrailsCompile_groovy$_run_closure3_closure8_closure9.doCall(_GrailsCompile_groovy:62)
    at _GrailsCompile_groovy$_run_closure3_closure8_closure9.doCall(_GrailsCompile_groovy)
    at _GrailsCompile_groovy.withCompilationErrorHandling(_GrailsCompile_groovy:69)
    at _GrailsCompile_groovy.this$4$withCompilationErrorHandling(_GrailsCompile_groovy)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:168)
    at _GrailsCompile_groovy$_run_closure3_closure8.doCall(_GrailsCompile_groovy:61)
    at _GrailsCompile_groovy$_run_closure3_closure8.doCall(_GrailsCompile_groovy)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at _GrailsCompile_groovy$_run_closure3.doCall(_GrailsCompile_groovy:58)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantMetaClass.processClosure(GantMetaClass.java:81)
    at org.codehaus.gant.GantMetaClass.processArgument(GantMetaClass.java:95)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:128)
    at _GrailsCompile_groovy$_run_closure2.doCall(_GrailsCompile_groovy:45)
    at org.codehaus.gant.GantMetaClass.invokeMethod(GantMetaClass.java:133)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16_closure18.doCall(GantBinding.groovy)
    at org.codehaus.gant.GantBinding.withTargetEvent(GantBinding.groovy:90)
    at org.codehaus.gant.GantBinding.this$4$withTargetEvent(GantBinding.groovy)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy:185)
    at org.codehaus.gant.GantBinding$_initializeGantBinding_closure5_closure16.doCall(GantBinding.groovy)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:591)
    at gant.Gant.executeTargets(Gant.groovy:590)
Caused by: java.lang.NoClassDefFoundError: org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:63)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)
    ... 41 more
Caused by: java.lang.ClassNotFoundException: org.springframework.core.type.classreading.AnnotationMetadataReadingVisitor
    ... 45 more

我的尝试

  • 我尝试过grails compile --refresh-dependencies --stacktrace,但这会导致同样的错误。
  • 我也将 Spring 安全插件升级到 spring-security-core-2.0-RC3,但遇到了同样的错误

【问题讨论】:

  • 如果不查看完整的 BuildConfig,我有根据的猜测是“:spring-security-ui:1.0-RC2”有一个冲突的瞬态依赖关系,ivy 没有弄清楚,所以你需要添加适当的“排除”以允许一致的依赖关系图。

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


【解决方案1】:

我的 BuildConfig.groovy 中有 compile ":spring-security-core:2.0-RC4"。安全插件的文档不是最好的。

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 2016-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 2021-09-29
    • 1970-01-01
    相关资源
    最近更新 更多