Closed LarimarTyl closed 4 years ago
我修改了Log4JConfigListener之后部署到tomcat又出现了Context的错误:Cannot initialize context because there is already a root application context present - check whether you have multiple ContextLoader* definitions in your web.xml!
问题已经解决了,我用的SpringBoot的那个分支,打包到tomcat下运行,报了一个什么ContextLoaderListener相关的错误,是因为SpringBoot打包到tomcat运行启动类需要继承SpringBootServletInitializer然后重写configure方法,然后这个过程中已经初始化了一次ContextLoaderListener但是在web.xml中也有一个ContextLoaderListener的配置,把web.xml中的ContextLoaderListener相关配置注释了就可以了。
部署到tomcat中报错 Spring 5.0 废弃了Log4jConfigListener这个类,需要改用log4j2 来替换这个类