• web应用中webapp. root重用问题解决方案


    同一个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 omcat6

    webappsabc] instead of [D:Program Files omcat6webappsabc] 

    - 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. 

  • 相关阅读:
    环形缓冲区: ringbuf.c
    Linux内核中_IO,_IOR,_IOW,_IOWR宏的用法与解析
    list.h在用户态下的应用
    如何优雅的拔盘?
    谨慎调整内核参数:vm.min_free_kbytes
    Linux内核tracepoints
    网卡多队列
    How to use pthread_create && mutex?
    美国电子工程师最值得打工的50个东家
    关于零点和极点的讨论
  • 原文地址:https://www.cnblogs.com/pengyan5945/p/5218364.html
Copyright © 2020-2023  润新知