java.lang.IllegalStateException: Web app root system property already set to different value: 'webap



严重: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener
java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\redmanor_b2c_back\] instead of [D:\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\redmanor_b2c_front\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
 at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:144)
 at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117)
 at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4973)
 at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5467)
 at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
 at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
 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)



解决多重web应用中webapp. root重用的问题


       当在tomcate中发布多个同根的应用时,容易出现这样异常:

java.lang.IllegalStateException: Web app root system property already set to different value: 'Portal.root' = [C:\jakarta-tomcat-5.0.30\webapps\Portal\] instead of [C:\jakarta-tomcat-5.0.30\webapps\Poral\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!

 

        解决方法 一:

检查发布的多个Web应用的web.xml文件,其中是否定义了相同的webAppRootKey, 如:
### app1:
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>app1.root</param-value>   <!-- 第一个应用的根 -->
</context-param>

### app2:
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>app1.root</param-value>   <!-- 第二个应用的根 -->

</context-param>


解决方案二:

webAppRootKey是在java web项目的web.xml配置文件中表示项目的唯一标示,在Eclipse调试Web项目时,项目的路径是一个临时路径,不在真正的路径下,可以通过log4j日志的方式打印出属性值,来看看临时项目路径在哪里,可以用System.getProperty("web.sample.root");如果web.xm 内没有设置webAppRootKey项,是为默认设置,那么webAppRootKey就是缺省的"webapp.root"。


解决办法:    两个web应用中定义了相同的webAppRootKey或者都没有定义,则现在就需要为每个web都定义一个webAppRootKey。


         ### app1:


<context-param>


    <param-name>webAppRootKey</param-name>


    <param-value>app1.root</param-value>


</context-param>


 
### app2:


<context-param>


    <param-name>webAppRootKey</param-name>


    <param-value>app2.root</param-value>


</context-param>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值