Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
報錯日志
tomcat里面跑了多個項目,啟動時報如下錯誤:
嚴重: The web application [/drc] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 十月 17, 2019 9:49:33 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 嚴重: The web application [/drc] appears to have started a thread named [Timer-10] but has failed to stop it. This is very likely to create a memory leak. 十月 17, 2019 9:49:33 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 嚴重: The web application [/drc] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] but has failed to stop it. This is very likely to create a memory leak. 十月 17, 2019 9:49:33 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 嚴重: The web application [/drc] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] but has failed to stop it. This is very likely to create a memory leak. 十月 17, 2019 9:49:33 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 嚴重: The web application [/drc] appears to have started a thread named [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] but has failed to stop it. This is very likely to create a memory leak. 十月 17, 2019 9:49:33 上午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads 嚴重: The web application [/drc] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.查看localhost.2019-10-17.log日志發現報錯如下:
嚴重: 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' = [/usr/local/apache-tomcat-7.0.55/webapps/mobile/] instead of [/usr/local/apache-tomcat-7.0.55/webapps/drc/] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:151)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:4992)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5490)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1247)at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1898)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)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)日志中字面表述:'webapp.root' = [/usr/local/apache-tomcat-7.0.55/webapps/mobile/] instead of [/usr/local/apache-tomcat-7.0.55/webapps/drc/] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
大概意思:webapp.root的這個key的值是 [/usr/local/apache-tomcat-7.0.55/webapps/mobile/],而不是[/usr/local/apache-tomcat-7.0.55/webapps/drc/] --為 'webAppRootKey' context-param 選擇一個唯一值在你的web.xml中
解決方法
為后來加載的項目設置新的’webAppRootKey’值,修改項目的web.xml添加如下內容:
<context-param> <param-name>webAppRootKey</param-name> <param-value>drc.root</param-value> </context-param>
重啟tomcat,問題解決。
問題分析
可以理解為tomcat部署的多個項目都使用log4j,如果在項目的web.xml中沒有定義webAppRootKey參數,那么她的缺省值就是"webapp.root",就我的這個問題而言,可以理解為“webapp.root”這個key已經指向了項目mobile,不能再指向項目drc了。
所以解決辦法就是,在項目的web.xml里面聲明 webAppRootKey。
參考鏈接
1.Choose unique values for the ‘webAppRootKey’ context-param in your web.xml files!
2.WebApproot in Spring
總結
以上是生活随笔為你收集整理的Choose unique values for the 'webAppRootKey' context-param in your web.xml files!的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: split命令--linux切割(拆分)
- 下一篇: Centos7.6下安装Python3.