日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Choose unique values for the 'webAppRootKey' context-param in your web.xml files!

發布時間:2025/4/16 编程问答 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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!的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。