您的位置:首页 > 运维架构 > Tomcat

tomcat部署多个项目webAppRootKey冲突

2015-08-24 15:52 441 查看
在tomcat下部署了2个项目,但是启动之后项目不能正常访问。

在catalina.ou中找到log

SEVERE: Context [/getfood] startup failed due to previous errors


说明项目启动失败了。

再看localhost.2015-08-24.txt,找到了报错的日志:

java.lang.IllegalStateException: Web app root system property already set to different value: 'webapp.root' = [/root/apache-tomcat-7.0.61/webapps/wechat/] instead of [/root/apache-tomcat-7.0.61/webapps/getfood/] - Choose unique values for the 'webAppRootKey' context-param in your web.xml files!
at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:132)
at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:118)
at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
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:652)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1090)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1900)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
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)


就是说webAppRootKey配置冲突。

但是查看了两个项目的web.xml文件,并没有配置这个参数。

最后看别人的文章才明白,原来如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root"。但最好设置,以免项目之间的名称冲突。

定义以后,在Web Container启动时将把ROOT的绝对路径写到系统变量里。

不过貌似现在都是一个tomcat 下部署一个项目,所以这种情况出现的机会也不是很多。

参考文章:http://blog.sina.com.cn/s/blog_6d002146010125ws.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: