由于系統架構需要同時啟動多個web項目,開發時每個項目用不同的tomcat啟動,沒有任何問題,等到釋出時放在同一個tomcat中時出現異常資訊,分析原因如下:
當在tomcat的server.xml中部署多個web應用時,出現這種異常:
java.lang.IllegalStateException: Web app root system property already set to different value: 'abc' = [F:\workspace_mfms\platform\WebContent\] instead of [F:\workspace_mfms\mfms\WebContent\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:148)
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:4887)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)
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$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
解決辦法:
打開web應用中的web.xml檔案,檢視
并檢查兩個應用中的webAppRootKey是否定義了相同的值