Spring Boot应用程序不会从Eclipse开始,而是从Cygwin工作 [英] Spring Boot application won't start from Eclipse, but works from Cygwin

查看:231
本文介绍了Spring Boot应用程序不会从Eclipse开始,而是从Cygwin工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从头开始从事Spring引导应用程序的工作,并将其配置为在[ http://spring.io/guides/gs/convert-jar-to-war/]

I started to work on Spring Boot application from scratch and I configure it as it is described on [http://spring.io/guides/gs/convert-jar-to-war/].

这是可以从Cygwin和Eclipse中运行它。
但是当我尝试添加依赖关系到我的 gradle.build 中的另一个项目时出现问题。

It was possible to run it from Cygwin and also from Eclipse. But the problem occurred when I tried to add dependency to another project in my gradle.build.

em> compile(project(':my.another.project'))到gradle.build 中的依赖关系部分,从那时起就不可能从Eclipse中运行它。但是从cygwin来看,一切正常。

I've added compile(project(':my.another.project')) to dependencies section in gradle.build and from that point it was not possible to run it from Eclipse. But from cygwin everything works normally.

我试图将依赖关系改为某个其他项目,但仍然有相同的错误。当我删除所有依赖项时,一切都可以正常工作。

I tried to change dependency to some other project but there is still the same error. When I remove all dependencies everything works fine.

所以,基本上来自Cygwin的一切都可以正常工作,而当项目依赖于另一个项目时它在Eclipse中失败。
你有什么想法可能我有问题吗?

So, basically from Cygwin everything works fine and it fails in Eclipse when project has dependencies to another projects. Do you have any idea where might me a problem?

例外:

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@389cce04: startup date [Fri Jun 13 11:42:55 CEST 2014]; 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:1049)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:152)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:329)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
    at eu.myapp.Application.main(Application.java:19)

2014-06-13 11:42:55.901  WARN 9408 --- [           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@389cce04: startup date [Fri Jun 13 11:42:55 CEST 2014]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:152)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:329)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
    at eu.myapp.Application.main(Application.java:19)

2014-06-13 11:42:55.902  INFO 9408 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@4a0c85dc: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,application,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,helloController,org.springframework.aop.config.internalAutoProxyCreator]; root of factory hierarchy
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:66)
    at org.springframework.context.annotation.ConfigurationClassParser.processImport(ConfigurationClassParser.java:377)
    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:630)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:120)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:648)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:898)
    at eu.myapp.Application.main(Application.java:19)


推荐答案

当您添加额外的项目时,是否更改了Eclipse元数据?您需要告诉Eclipse您的项目取决于额外的项目(例如,使用 gradle cleanEclipse eclipse ,如果这是最初的方式)。

Did you change the Eclipse metadata when you added the extra project? You would need to tell Eclipse that your project depends on the extra one (e.g. using gradle cleanEclipse eclipse if that's how you did it originally).

这篇关于Spring Boot应用程序不会从Eclipse开始,而是从Cygwin工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆