解决ApplicationEventMulticaster not initialized - call ‘refresh’ before multicasting events via the context: Root WebApplicationContext异常
我的个人微信公众号 “源码客栈”;分享Java源码和技术文章和Java视频资料,感兴趣可以关注下
引言
今天我在运行ssh项目时报了如下错误,导致我访问项目页面出现404
1.ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: Root WebApplicationContext: startup date [Sat Jul 18 22:34:04 CST 2020]; root of context hierarchy.。。。
2.LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Sat Jul 18 22:34:04 CST 2020]; root of context hierarchy
截图如下
原因分析
这种情况的首要原因与数据库的连接有问题,也就是我们在spring配置bean里的dataSource的url连接有问题了。我是这样写的:
<property name="url">
<value>jdbc:mysql://localhost:3306/db_hotel?useUnicode=true&characterEncoding=utf-8</value>
</property>
后来改了一下
<property name="url">
<value>jdbc:mysql://localhost:3306/db_hotel?useUnicode=true&characterEncoding=utf-8</value>
</property>
对的,加了& ;就不会报错了,成功运行起了项目!如下: