Web. XML <context-param> can only put a pair of <param-name> and <param-value>

Source: Internet
Author: User
Tags addchild

When you configure multiple instances in Tomcat, you cannot use the default Webapprootkey, you need to explicitly configure the Webapprootkey value in Web. XML, otherwise you will get an error at startup, as shown below

Severity:  exception sending context initialized event to listener instance  of class ch.qos.logback.ext.spring.web.logbackconfiglistenerjava.lang.illegalstateexception:  web app root system property already set to different value :  ' Webapp.root '  = [c:\apache-tomcat-8.0.32\webapps\weblearn\] instead of [c:\ apache-tomcat-8.0.32\webapps\weblearn3\] - choose unique values for the  ' Webapprootkey '  context-param in your web.xml files!at  Org.springframework.web.util.WebUtils.setWebAppRootSystemProperty (webutils.java:162) at  Ch.qos.logback.ext.spring.web.WebLogbackConfigurer.initLogging (Unknown source) at  Ch.qos.logback.ext.spring.web.LogbackConfigListener.contextInitialized (Unknown source) at  Org.apache.catalina.core.StandardContext.listenerStart (standardcontext.java:4812) at org.Apache.catalina.core.StandardContext.startInternal (standardcontext.java:5255) at  Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:147) at  Org.apache.catalina.core.ContainerBase.addChildInternal (containerbase.java:725) at  Org.apache.catalina.core.ContainerBase.addChild (containerbase.java:701) at  Org.apache.catalina.core.StandardHost.addChild (standardhost.java:717) at  Org.apache.catalina.startup.HostConfig.deployDescriptor (hostconfig.java:585) at  Org.apache.catalina.startup.hostconfig$deploydescriptor.run (hostconfig.java:1794) at  Java.util.concurrent.executors$runnableadapter.call (executors.java:511) at  Java.util.concurrent.FutureTask.run (futuretask.java:266) at  Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142) at  Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617) At java.lang.Thread.run ( thread.java:745)

Therefore, Webapprootkey is configured in Web. XML, because the configuration of Logback was previously configured, so the configuration of Webapprootkey is put together with the Logback configuration, as shown below.

<context-param><param-name>logbackconfiglocation</param-name><param-value>/web-inf/ Config/logback3.xml</param-value><param-name>webapprootkey</param-name><param-value> Weblearn3.root</param-value></context-param>

Restart the server found no above error, but the server log is not generated to the file, so Judge Context-param can only put a pair of param-name and Param-value, and finally modified as follows

<context-param><param-name>webapprootkey</param-name><param-value>weblearn3.root</ param-value></context-param><context-param><param-name>logbackconfiglocation</ Param-name><param-value>/web-inf/config/logback3.xml</param-value></context-param>

Problem solving

This article from "Dream do not know is a guest" blog, reproduced please contact the author!

Web. XML <context-param> can only place a pair of <param-name> and <param-value>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.