java.lang.IllegalStateException:ApplicationEventMulticaster未初始化 -

时间:2017-08-17 01:25:21

标签: spring maven spring-mvc

我正在尝试运行一个Spring项目。 pom.xml中:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.ocp</groupId>
<artifactId>testruleemall</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>testruleemall</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <vaadin.version>8.0.5</vaadin.version>
    <tomcat.version>8.0.5</tomcat.version>
    <start-class>org.ocp.test</start-class>
</properties>

<dependencies>
    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-spring-boot-starter</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.3.11.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.11.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <version>1.0.1.Final</version>
    </dependency>
    <dependency>
        <groupId>com.github.noraui</groupId>
        <artifactId>ojdbc7</artifactId>
        <version>12.1.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>1.1.7</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>6.0.4</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.9.9</version>
    </dependency>
    <!--thymeleaf-->
    <dependency>
        <groupId>org.thymeleaf</groupId>
        <artifactId>thymeleaf</artifactId>
        <version>3.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.thymeleaf</groupId>
        <artifactId>thymeleaf-spring4</artifactId>
        <version>3.0.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>nz.net.ultraq.thymeleaf</groupId>
        <artifactId>thymeleaf-layout-dialect</artifactId>
        <version>2.2.1</version>
    </dependency>
    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache-core</artifactId>
        <version>2.4.3</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-ehcache</artifactId>
        <version>4.3.11.Final</version>
    </dependency>
    <!--webjars-->
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap</artifactId>
        <version>3.3.7</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>font-awesome</artifactId>
        <version>4.6.1</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>nprogress</artifactId>
        <version>0.2.0</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>jquery</artifactId>
        <version>2.2.3</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>fastclick</artifactId>
        <version>1.0.6</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>webjars-locator</artifactId>
        <version>0.30</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>bootstrap-toggle</artifactId>
        <version>2.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>iCheck</artifactId>
        <version>1.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net</artifactId>
        <version>1.10.11</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-bs</artifactId>
        <version>1.10.11</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-buttons</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-buttons-bs</artifactId>
        <version>1.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-fixedheader</artifactId>
        <version>3.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-fixedheader-bs</artifactId>
        <version>3.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-keytable</artifactId>
        <version>2.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-keytable-bs</artifactId>
        <version>2.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-responsive</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-responsive-bs</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-scroller</artifactId>
        <version>1.4.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>datatables.net-scroller-bs</artifactId>
        <version>1.4.2</version>
    </dependency>
    <dependency>
        <groupId>org.webjars.bower</groupId>
        <artifactId>pdfmake</artifactId>
        <version>0.1.20</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains</groupId>
        <artifactId>annotations</artifactId>
        <version>RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>animate.css</artifactId>
        <version>3.5.1</version>
    </dependency>
    <dependency>
        <groupId>org.webjars</groupId>
        <artifactId>bootstrap-select</artifactId>
        <version>1.4.2</version>
    </dependency>


</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>9.4.0.M0</version>
        </plugin>
    </plugins>
</build>

结果如下:

  

2017-08-17 01:11:01.405 INFO 9156 --- [restartedMain] org.ocp.TestruleemallApplication:在带有PID 9156的DESKTOP-PL25CTR上启动TestruleemallApplication(C:\ Users \ Ilias \ Desktop \ testruleemall \ testruleemall \目标\类由Ilias在C:\ Users \ Ilias \ Desktop \ testruleemall \ testruleemall中启动)   2017-08-17 01:11:01.406 INFO 9156 --- [restartedMain] org.ocp.TestruleemallApplication:没有活动的配置文件集,回退到默认配置文件:default   2017-08-17 01:11:01.651 INFO 9156 --- [restartedMain] s.c.a.AnnotationConfigApplicationContext:刷新org.springframework.context.annotation.AnnotationConfigApplicationContext@5a289d1d:启动日期[Thu Aug 17 01:11:01 UTC 2017];上下文层次结构的根   2017-08-17 01:11:02.257 WARN 9156 --- [restartedMain] scaAnnotationConfigApplicationContext:在上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.BeanDefinitionStoreException:无法解析配置类[org.ocp .TestruleemallApplication];嵌套异常是java.lang.IllegalStateException:无法在类org.springframework.boot.web.support.SpringBootServletInitializer上内省带注释的方法   2017-08-17 01:11:02.261 ERROR 9156 --- [restartedMain] o.s.b.f.s.DefaultListableBeanFactory:在bean上销毁名为&#39; org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory&#39;抛出异常

     

java.lang.IllegalStateException:ApplicationEventMulticaster未初始化 - 调用&#39;刷新&#39;在通过上下文组播事件之前:org.springframework.context.annotation.AnnotationConfigApplicationContext@5a289d1d:启动日期[Thu Aug 17 01:11:01 UTC 2017];上下文层次结构的根       在org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404)[spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97)〜[spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253)〜[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)[spring-beans-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033)[spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)[spring-context-4.3.8.RELEASE.jar:4.3.8.RELEASE]       在org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]       在org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]       在org.springframework.boot.SpringApplication.run(SpringApplication.java:314)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)[spring-boot-1.5.3.RELEASE.jar:1.5.3.RELEASE]       在org.ocp.TestruleemallApplication.main(TestruleemallApplication.java:20)[classes /:na]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[na:1.8.0_131]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_131]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8.0_131]       在java.lang.reflect.Method.invoke(Method.java:498)〜[na:1.8.0_131]       在org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)[spring-boot-devtools-1.5.3.RELEASE.jar:1.5.3.RELEASE]

1 个答案:

答案 0 :(得分:0)

将依赖项cglib的版本升级到3.2.4并更新项目并在入门应用程序类上使用spring boot批注@SpringBootApplication。并分享您的课程和配置。