tomcat部署多个项目webAppRootKey冲突

在tomcat下部署了2个项目,但是启动之后项目不能正常访问。

在catalina.ou中找到log

 SEVERE: Context [/getfood] startup failed due to previous errors 


说明项目启动失败了。

再看localhost.2015-08-24.txt,找到了报错的日志:

java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [/root/apache-tomcat-7.0.61/webapps/wechat/] instead of [/root/apache-tomcat-7.0.61/webapps/getfood/] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
        at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:132)
        at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:118)
        at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:47)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1090)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1900)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

就是说webAppRootKey配置冲突。

但是查看了两个项目的web.xml文件,并没有配置这个参数。

最后看别人的文章才明白,原来如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root"。但最好设置,以免项目之间的名称冲突。
定义以后,在Web Container启动时将把ROOT的绝对路径写到系统变量里。

不过貌似现在都是一个tomcat 下部署一个项目,所以这种情况出现的机会也不是很多。


参考文章:http://blog.sina.com.cn/s/blog_6d002146010125ws.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值