tomcat同时存在多个项目webapp.root问题

最近,想copy一份工程来做另一个项目,用因此当t1 和t2 都在tomcat的编译项目的时候会出现错误:

2016-5-18 9:45:40 org.apache.catalina.core.StandardContext listenerStart

严重: 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' = [F:\JDKandTOMCAT\TOMCAT\Tomcat6.0\webapps\t1\] instead of [F:\JDKandTOMCAT\TOMCAT\Tomcat6.0\webapps\t2\] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
原因是当在web.xml中没显示指定webAppRootKey元素,如果不指定都默认为webapp.root,重复!

解决方法1:webapp.root重复

在t1工程的中web.xml中添加
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>t1.root</param-value>
</context-param>

在t2工程的中web.xml中添加
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>t2.root</param-value>
</context-param>

改完以后,问题解决!

 

参照:

http://blog.163.com/chenjie_8392/blog/static/4393398420092241812295/

http://liaojuncai.iteye.com/blog/1986300

猜你喜欢

转载自zhangshufei8001.iteye.com/blog/2377285