tomcat发布多个项目

最近在项目中需要在tomcat中发布多个web项目,在启动的时候发生报错,报错信息如下:

java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [....\tmp1\wtpwebapps\workreport\] instead of [.....\wtpwebapps\ApprovalFront\] 
- Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
    at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:150)
    at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:116)
    at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
    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$StartChild.call(ContainerBase.java:1575)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    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:722)

通过报错信息加上百度查询,原来web项目发布多个时,需要在web.xml中定义唯一的webAppRootKey,解决办法:
在每个web项目中的web.xml文件中定义webAppRootKey属性,如下:、

 <!--web1中的web.xml-->
<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>ysdq-web</param-value>
</context-param>

<!--web2中的web.xml-->
<context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>ysdq-web-in</param-value>
</context-param>

此外,在运行web项目时经常遇到以下问题:
Resource is out of sync with the file system
主要原因:文件系统不同步造成的
解决办法:
选中工程,右键,选择F5(手动刷新);

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值