java web error:Choose unique values for the 'webAppRootKey'

描述:

tomcat部署多个web工程的时候抛异常:

写道
java web error:Choose unique values for the 'webAppRootKey' context-param in your web.xml files

原因:

写道
1.Log4jWebConfigurer在初始化日志的时候调用WebUtils.setWebAppRootSystemProperty
2.setWebAppRootSystemProperty的时候
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 && !StringUtils.pathEquals(oldValue, root)) {
throw new IllegalStateException(
"Web app root system property already set to different value: '" +
key + "' = [" + oldValue + "] instead of [" + root + "] - " +
"Choose unique values for the 'webAppRootKey' context-param in your web.xml files!");
}
key重复报错了

解决方式:

web.xml中设置不同的

public static final String WEB_APP_ROOT_KEY_PARAM = "webAppRootKey";

如:

<context-param>
	<param-name>webAppRootKey</param-name>
	<param-value>www.linkrmb.com</param-value>
	<description>领客网目标:扫遍京东、天猫折扣最低的商品!</description>
</context-param>

尽可能的用域名或者host等唯一性比较强的做key

其默认值为:

public static final String DEFAULT_WEB_APP_ROOT_KEY = "webapp.root";

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值