同一个tomcat服务器里面部署两个JavaEE项目,都是用了log4j做日志。并且web.xml里面都监听了日志信息。

启动服务的时候报错。

于是在web.xml添加以下代码:

 

<display-name>myapp001</display-name>

	<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myapp001.root</param-value>
</context-param>

 

 

<display-name>myapp002</display-name>

	<context-param>
<param-name>webAppRootKey</param-name>
<param-value>myapp002.root</param-value>
</context-param>

 

 

 

tomcat6中部署了两个web应用,都采用的是struts2+spring+hibernate框架,记录日志都用了log4j,结果webroot.app被重用了,启动tomcat时,出现错误,部分

错误信息如下:

严重: 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' = [D:\Program Files\tomcat6

\webapps\abc\] instead of [D:\Program Files\tomcat6\webapps\abc\] 

- Choose unique values for the 'webAppRootKey' context-param in your 

web.xml files!

 

 

 

At the end there are three possible solutions for the initial problem: 

(1) Provide any of your applications with a unique
'webAppRootKey'. 
(2) Set the servlet context parameter
'log4jExposeWebAppRoot' to   
'false'. This eliminates the use of log file
locations relative to
  
the web application's root directory but
still allows a log4j config   
location outside the classpath. 
(3) Remove
the 'Log4jConfigListener' from your application's web.xml. 

 

web应用中webapp. root重用问题解决方案的更多相关文章

  1. IntelliJ IDEA 2019.1.1 maven框架web.xml中web-app版本过低导致不能正常使用EL表达式的解决方案

     1.软件版本 IDEA版本:IntelliJ IDEA 2019.1.1 maven版本:apache-maven-3.6.1 Tomcat版本:tomcat-8.5 2.问题描述 IDEA使用如下 ...

  2. java web开发中遇到的问题及解决方案(个人学习日志,持续更新)

    转:http://blog.csdn.net/ducexu/article/details/7529613 2012.05.02   星期三 1.问题:导入的新工程,名字上出现感叹号. 原因:工程的j ...

  3. spring中的Log4jConfigListener作用和webapp.root的设置

    转:http://blog.sina.com.cn/s/blog_7bbf356c01016wld.html 使用spring中的Log4jConfigListener有如如下好处:     1. 动 ...

  4. Web app root system property already set to different value: 'webapp.root'

    java.lang.IllegalStateException: Web app root system property already set to different value: 'webap ...

  5. 【转载】两个Web.config中连接字符串中特殊字符解决方案

    userid =  test password = aps'"; 那么连接字符串的写法为: Provider=SQLOLEDB.1;Password="aps'"&quo ...

  6. SpringMVC,MyBatis项目中兼容Oracle和MySql的解决方案及其项目环境搭建配置、web项目中的单元测试写法、HttpClient调用post请求等案例

     要搭建的项目的项目结构如下(使用的框架为:Spring.SpingMVC.MyBatis): 2.pom.xml中的配置如下(注意,本工程分为几个小的子工程,另外两个工程最终是jar包): 其中 ...

  7. 服务器启动时Webapp的web.xml中配置的加载顺序

    一 1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点. 2.紧急着,容创建一个Ser ...

  8. C#实现多级子目录Zip压缩解压实例 NET4.6下的UTC时间转换 [译]ASP.NET Core Web API 中使用Oracle数据库和Dapper看这篇就够了 asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 asp.net core异步进行新增操作并且需要判断某些字段是否重复的三种解决方案 .NET Core开发日志

    C#实现多级子目录Zip压缩解压实例 参考 https://blog.csdn.net/lki_suidongdong/article/details/20942977 重点: 实现多级子目录的压缩, ...

  9. 服务器启动时Webapp的web.xml中配置的加载顺序(转载)

    一 1.启动一个WEB项目的时候,WEB容器会去读取它的配置文件web.xml,读取<listener>和<context-param>两个结点. 2.紧急着,容创建一个Ser ...

随机推荐

  1. 【CSS系列-选择器优先级总结】

    转:http://www.cnblogs.com/dolphinX/p/3511300.html 容易被忽略CSS特性   CSS初学感觉很简单,但随着学习的深入才感觉CSS的水由多深,平常总会遇到各 ...

  2. Android下用Properties保存程序配置

    读写函数分别例如以下: import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Proper ...

  3. Ubantu下FTP服务器资源进行控制

    在FTP服务器的管理中无论对本地用户还是匿名用户,对于FTP服务器资源的使用都需要进行控控制, 避免由于负担过大造成FTP服务器运行异常, 可以添加以下配置项对FTP客户机使用FTP服务器资源进行控制 ...

  4. archlinux随记

    xrdb -merge .Xresources才能使urxvt的配色显示正常 xpmroot 包含在fvwm包中

  5. LeetCode1 Two Sum

    题目 :Given an array of integers, return indices of the two numbers such that they add up to a specifi ...

  6. C语言中和指针相关的四道题目

    例子1. void fun (int *x , int *y) { printf("%d, %d", *x, *y) ; *x = 3; *y = 4;} main(){ int ...

  7. 从零开始学JAVA(02)-用Eclipse写hello World

    在安装好JAVA开发环境的前提下开始以下工作,以下文章参考http://blog.csdn.net/ojtojt/article/details/3476157文章,进行测试编写日记,内容版权归原作者 ...

  8. iOS 切图使用 分辨率 使用 相关总结

    疑问: 就iphone来说分辨率有三种,320*480. 640*960. 640*1136 那么如果我想做图,如果是320*480 1.是不是所有的图片,比如按钮的,背景图的,尺寸都必须做成小于或等 ...

  9. js自动刷新页面代码

    <script language="JavaScript">function myrefresh(){window.location.reload();}setTime ...

  10. jQuery阻止事件冒泡的例子

    下面给给各位朋友稍加整理了一jquery中阻止事件冒泡的一些例子,我们知道JQuery 提供了两种方式来阻止事件冒泡,但我们简单的利用它来做一些应用可能不深入或不理解,下面整理了更详细的方法,有兴趣的 ...