码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat解决多个项目冲突

时间:2015-09-23 15:13:41      阅读:214      评论:0      收藏:0      [点我收藏+]

标签:

如果在tomcat里面运行多个项目的时候,而且你使用tomcat的监听器,实现类名也一样,就会发生冲突,比如报出这样的错误:

java.lang.IllegalStateException: Web app root system property already set to different value: ‘webapp.root‘ = [/alidata/weichat/] instead of [/alidata/hs/] - Choose unique values for the ‘webAppRootKey‘ context-param in your web.xml files!

at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:150)

at com.cms.common.util.LogbackWebConfigurer.initLogging(LogbackWebConfigurer.java:36)

at com.cms.common.util.LogbackConfigListener.contextInitialized(LogbackConfigListener.java:18)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)

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)


我的tomcat本来设置:

主要host节点:

<Host name="demo.aboutit.cn"  appBase="webapps"
            unpackWARs="false" autoDeploy="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->
        <Context path="" docBase="/alidata/hs" reloadable="false"/>
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />

      </Host>
<Host name="weichat.aboutit.cn"  appBase="webapps"
            unpackWARs="false" autoDeploy="false">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->
        <Context path="" docBase="/alidata/weichat" reloadable="false"/>
        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log." suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />

      </Host>

这样就会有冲突,解决办法:

项目的web.xml里面定义根节点,用于项目的区别:

<context-param>

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

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

    </context-param>


tomcat解决多个项目冲突

标签:

原文地址:http://my.oschina.net/Tonyjingzhou/blog/510028

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!