如何解决ssh项目中 call ‘refresh‘ before multicasting events异常

如何解决ssh项目中 call ‘refresh‘ before multicasting events异常,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

1.引言

今天我在运行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

2.截图如下

如何解决ssh项目中 call ‘refresh‘ before multicasting events异常

3.原因分析

这种情况的首要原因与数据库的连接有问题,也就是我们在spring配置bean里的dataSource的url连接有问题了。我是这样写的:

  <property name="url">

   <value>jdbc:mysql://localhost:3306/db_hotel?useUnicode=true&characterEncoding=utf-8</value>

</property>

4.后来改了这样写:

<property name="url">  <value>jdbc:mysql://localhost:3306/db_hoteluseUnicode=true&amp;characterEncoding=utf-8</value>

  </property>

对的,加了&amp ;就不会报错了,成功运行起了项目!如下所示:

如何解决ssh项目中 call ‘refresh‘ before multicasting events异常

5.成功运行了项目

如何解决ssh项目中 call ‘refresh‘ before multicasting events异常

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对亿速云的支持。