java.lang.IllegalArgumentException:Spring中的ResourceLoader不能为null

时间:2017-08-22 10:11:21

标签: java spring spring-security kerberos

我想在我的机器上运行https://github.com/spring-projects/spring-security-kerberos(通过Intellij的想法)。我正在尝试构建和运行的模块是sec-server-spnego-form-auth,但我一直得到java.lang.IllegalArgumentException: ResourceLoader must not be null以及java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context,这是因为第一个错误,我猜。

任何想法可能在这里出错?

堆栈跟踪:

2017-08-22 13:28:44.457 ERROR 15064 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.IllegalArgumentException: ResourceLoader must not be null
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.<init>(AutoConfigurationSorter.java:53)
    at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:72)
    at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:393)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:205)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:164)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:139)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:284)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:632)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
    at demo.app.Application.main(Application.java:13)

2017-08-22 13:28:44.457  INFO 15064 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@ec4505: startup date [Tue Aug 22 13:28:44 EEST 2017]; root of context hierarchy
2017-08-22 13:28:44.458  WARN 15064 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception thrown from ApplicationListener handling ContextClosedEvent

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@ec4505: startup date [Tue Aug 22 13:28:44 EEST 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:347)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:334)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1051)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:150)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1012)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:343)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
    at demo.app.Application.main(Application.java:13)

2017-08-22 13:28:44.459  WARN 15064 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception thrown from LifecycleProcessor on context close

java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@ec4505: startup date [Tue Aug 22 13:28:44 EEST 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1059)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:150)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1012)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:343)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
    at demo.app.Application.main(Application.java:13)

Exception in thread "main" java.lang.IllegalArgumentException: ResourceLoader must not be null
    at org.springframework.util.Assert.notNull(Assert.java:112)
    at org.springframework.boot.autoconfigure.AutoConfigurationSorter.<init>(AutoConfigurationSorter.java:53)
    at org.springframework.boot.autoconfigure.EnableAutoConfigurationImportSelector.selectImports(EnableAutoConfigurationImportSelector.java:72)
    at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:393)
    at org.springframework.context.annotation.ConfigurationClassParser.doProcessConfigurationClass(ConfigurationClassParser.java:205)
    at org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:164)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:139)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:284)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:225)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:632)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:961)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:950)
    at demo.app.Application.main(Application.java:13)
2017-08-22 13:28:44.459  INFO 15064 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@192cfe: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,application,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,mvcConfig,webSecurityConfig]; root of factory hierarchy

Process finished with exit code 1

1 个答案:

答案 0 :(得分:-1)

好吧,我只是通过只需要我需要的模块并将其复制到一个新项目来解决它。此外,我不得不使用application.properties而不是.yml文件,它就像一个魅力。

不是最好的解决方案,但它有效。