一个tomcat下有多个应用时 多个Context启动冲突的问题解决

来源:互联网 发布:gta5pc女角色捏脸数据 编辑:程序博客网 时间:2024/06/07 00:27

在Tomcat的server.xml中配置两个context,出现其中一个不能正常启动,交换配置顺序,另一个又不能正常启动,即始终只有第二个配置能启动的情况。如果单独部署,都没有问题。报错大致内容如下:

appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak.

起初以为是内存分配不够,但加大了内容配置问题依然。

于是在localhost.log中又找到以下错误信息:


严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListenerjava.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [/home/web/grows/] instead of [/home/web/mall/] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
大意是Log4jConfigListener在获取webapp.root值时,被后一context的值替换掉了,所以要在各个项目的web.xml中配置不同的webAppRootKey值,随即在其中一个web.xml中添加:

<context-param><param-name>webAppRootKey</param-name><param-value>web.sample.root</param-value></context-param>

重启tomcat,问题解决。

阅读全文
0 0
原创粉丝点击