java.lang.IllegalState Ausnahme LifecylceProcessor und ApplicationEventMulticaster nicht initialisiert, wenn mit Spring Boot
Habe ich eine spring-boot-wrapper-Klasse wie folgt:
package package.for;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan
@EnableAutoConfiguration
public class AppBooter {
public static void main(String args[]){
SpringApplication.run("path/to/context.xml", args);
System.out.println("============ done");
do{
}while(true);
}
}
context.xml enthält das bean verweist auf die main-Klasse wie folgt:
<bean id="starter" class="package.for.AppBooter" />
sowie mehrere andere Bohnen, die ich verlange.
Als für die Abhängigkeiten habe ich Folgendes:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>1.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>axis</groupId>
<artifactId>axis-wsdl4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId> wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.7.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>sitemesh</artifactId>
<version>2.5</version>
</dependency>
Allerdings, wenn ich laufen, ich bekomme folgende Ausnahmen:
Exception in thread "main" 2014-10-07 16:12:54.267 INFO 4616 --- [ Thread-1] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6c4cbf96: startup date [Tue Oct 07 16:12:50 CEST 2014]; root of context hierarchy
java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationDelegate.<init>(Lorg/springframework/data/repository/config/RepositoryConfigurationSource;Lorg/springframework/core/io/ResourceLoader;Lorg/springframework/core/env/Environment;)V
at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport.registerBeanDefinitions(AbstractRepositoryConfigurationSourceSupport.java:58)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:319)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:139)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:324)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:243)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:94)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:608)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:463)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:109)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
at package.for.AppBooter.main(AppBooter.java:12)
2014-10-07 16:12:54.303 WARN 4616 --- [ Thread-1] 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@6c4cbf96: startup date [Tue Oct 07 16:12:50 CEST 2014]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:345)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:332)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:879)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:808)
2014-10-07 16:12:54.304 WARN 4616 --- [ Thread-1] 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@6c4cbf96: startup date [Tue Oct 07 16:12:50 CEST 2014]; root of context hierarchy
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:358)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:887)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.doClose(EmbeddedWebApplicationContext.java:141)
at org.springframework.context.support.AbstractApplicationContext$1.run(AbstractApplicationContext.java:808)
So, wie ich bin-Verpackung das Glas hier ist das plugin snippet:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>package.for.AppBooter</mainClass>
</configuration>
<version>1.1.5.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions
</plugin>
Bitte fügen Sie alle Ihre Abhängigkeiten der post.
Hinzugefügt zu den ursprünglichen post
Hinzugefügt zu den ursprünglichen post
InformationsquelleAutor mangusbrother | 2014-10-07
Du musst angemeldet sein, um einen Kommentar abzugeben.
Diese wurde gelöst durch ein Upgrade spring-web-und spring-webmvc Abhängigkeiten zu 4.0.7.RELEASE
InformationsquelleAutor mangusbrother
War ich vor diesem Fehler und ich hatte auch schon 4.3.2.RELEASE für spring-web-und spring-web-mvc.
Ist es gelöst, war dies aufgrund der Definition von spring-data-releasetrain. Entfernen, der das problem löste.
InformationsquelleAutor Mehdi Raza
Ich denke, die Ursache des Problems ist ein
NoSuchMethodError
:Du noch nicht gepostet, alle details der Spring-Daten-Abhängigkeiten, aber sieht aus wie Sie versuchen, eine version verwenden, die eines der Spring-Data-Projekte, die nicht kompatibel mit der version von Spring Boot, die Sie verwenden. Spring Boot stellt dependency-management für die dann gesamte Spring Data release train, so dass Ihre beste option ist wahrscheinlich, einfach die version aus jedem Frühling Abhängigkeiten in Ihre pom und lassen Sie Spring Boot ein dependency management übernehmen Sie die Kontrolle der version.
alle Abhängigkeiten
InformationsquelleAutor Andy Wilkinson
Hatte dasselbe Problem und war nicht Abhängigkeiten Verwandte.
Hatte ich den folgenden code:
Ändern, um die folgenden gemacht:
Ich bin nicht sicher, warum dies verursachte ein Problem, obwohl. Vielleicht können Sie nicht verwenden, Konstruktor-Injektion, wenn Sie möchten verwenden es in Bohnen. Hoffe mir kann jemand Antwort in den Kommentaren
InformationsquelleAutor Doug