http://blog.csdn.net/chenyongsuda/article/details/5589410
Booting Tomcat is an error:
Web App root system property already set to different value: ' Webapp.root ' = [E:\AIT\poscoGroup\web\] instead of [E:\AIT\T Omcat-6.0\webapps\posco\]-Choose unique values for the ' Webapprootkey '
Solution:
Here are the reprint:
Because laziness wants to copy a project to do the test so when Averportal and Averportaltest are in the Tomcat compile project, there will be errors
2010-5-14 9:45:40 Org.apache.catalina.core.StandardContext Listenerstart
Severity: Exception sending context initialized event to listener instance of class Org.springframework.web.util.Log4jConfigLis Tener
Java.lang.IllegalStateException:Web App root system property already set to different value: ' Webapp.root ' = [f:/jdkandto Mcat/tomcat/tomcat 6.0/webapps/averportal/] Instead of [F:/jdkandtomcat/tomcat/tomcat 6.0/webapps/averportaltest/]- Choose unique values for the ' Webapprootkey ' Context-param in your web. XML files!
The reason is that when not specified in Web. xml
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>AVerPortalTest</param-value>
</context-param>
When you follow the default
Procedure 1
In Tomcatserver Startup project directory Delete averportal and averportaltest one of the
Procedure 2
On the web. Add Webapprootkey in XML specify good
Recently, because of laziness, directly from the original project to cut out a block into a project, and then launch at the same time, the following exception occurred
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:/tomcat-5 .0.19/webapps/tzbms/] instead of [d:/tomcat-5.0.19/webapps/its/]-Choose unique values for the ' Webapprootkey ' context-p Aram in your web. XML files!
At Org.springframework.web.util.WebUtils.setWebAppRootSystemProperty (webutils.java:99)
At Org.springframework.web.util.Log4jWebConfigurer.initLogging (log4jwebconfigurer.java:116)
At Org.springframework.web.util.Log4jConfigListener.contextInitialized (log4jconfiglistener.java:51)
At Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:3773)
At Org.apache.catalina.core.StandardContext.start (standardcontext.java:4270)
At Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:866)
At Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:850)
At Org.apache.catalina.core.StandardHost.addChild (standardhost.java:638)
At Org.apache.catalina.core.StandardHostDeployer.install (standardhostdeployer.java:320)
At Org.apache.catalina.core.StandardHost.install (standardhost.java:875)
At Org.apache.catalina.startup.HostConfig.deployWARs (hostconfig.java:657)
At Org.apache.catalina.startup.HostConfig.deployApps (hostconfig.java:476)
At Org.apache.catalina.startup.HostConfig.start (hostconfig.java:1008)
At Org.apache.catalina.startup.HostConfig.lifecycleEvent (hostconfig.java:394)
At Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:166)
At Org.apache.catalina.core.ContainerBase.start (containerbase.java:1134)
At Org.apache.catalina.core.StandardHost.start (standardhost.java:832)
At Org.apache.catalina.core.ContainerBase.start (containerbase.java:1126)
At Org.apache.catalina.core.StandardEngine.start (standardengine.java:521)
At Org.apache.catalina.core.StandardService.start (standardservice.java:519)
At Org.apache.catalina.core.StandardServer.start (standardserver.java:2345)
At Org.apache.catalina.startup.Catalina.start (catalina.java:594)
At Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
At Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:39)
At Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:25)
At Java.lang.reflect.Method.invoke (method.java:324)
At Org.apache.catalina.startup.Bootstrap.start (bootstrap.java:297)
At Org.apache.catalina.startup.Bootstrap.main (bootstrap.java:398)
Look at the exception, it is quite simple, should be two items of the settings repeated, resulting in an error, but I found that the Web. XML is not configured Webapprootkey, and then read the online information, reference
Hwctl's Column http://blog.csdn.net/hwctl/archive/2007/07/31/1719597.aspx
, the original is because if no WEB.XM is set within the Webapprootkey item, is the default setting
public static void Setwebapprootsystemproperty (ServletContext servletcontext) throws IllegalStateException {
String param = servletcontext.getinitparameter (web_app_root_key_param);
String key = (param! = null? param:default_web_app_root_key);
String oldValue = System. GetProperty (key);
if (oldValue! = null) {
throw new IllegalStateException ("Warning:web app root system property already set:" + key + "=" +
OldValue + "-Choose unique Webapprootkey values in your web. XML files!");
}
String root = Servletcontext.getrealpath ("/");
if (root = = null) {
throw new IllegalStateException ("Cannot set web App root system property when WAR file was not
Expanded ");
}
System. SetProperty (key, Root);
ServletContext.log ("Set Web App root system property:" + key + "=" + root);
}
As you see from the code, this method actually saves the absolute file path of the root of the Web application as a property in the system's property list. The name of the property is indicated by the parameter value named "Webapprootkey" in the Web. xml file. If you do not define the Webapprootkey parameter in Web. XML, the property name is the default "Webapp.root". The Webapprootkey parameter has been defined in our Petclinic project with a value of "Petclinic.root" , so the name of the property is "Petclinic.root".
Finally, the Webapprootkey item is configured and the error is resolved.
Solve WebApp in multiple Web applications. Root re-usable issues