Hi all,
when deploying two applications build from the riot skeleton within
the same Tomcat servlet container, you get an
IllegalStateException: Web app root system property already set to
different value: 'webapp.root' = [/Users/joe/
Workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/webapps/
webapp-A/] instead of [/Users/joe/Workspace/.metadata/.plugins/
org.eclipse.wst.server.core/tmp0/webapps/webapp-B/] - Choose unique
values for the 'webAppRootKey' context-param in your web.xml files!
I will try to explain where this comes from and how to circumvent it,
but first the quick fix for the impatient reader: Place a context
parameter named 'webAppRootKey' in every project's web.xml and assign
a value to it, that is unique for every of your projects like the
project name itself.
The webAppRootKey context parameter is introduced by Spring. Along
with the WebAppRootListener it allows exposing the web applications
root directory as a system property. The value of the context
parameter 'webAppRootKey' names the system property to use. If the
context parameter 'webAppRootKey' is not set in the application's
web.xml, Spring chooses the default value 'app.root'. While some
servlet containers like Resin do isolate each web application's
system properties, others like Tomcat do not. And that's what the
former mentioned IllegalStateException is telling us: The system
property 'app.root' already contains the root directory of the first
web application when Spring tries to assign the root directoty of the
second application to it.
Ok, that's the background information. A deeper look into the web.xml
tells us, that there ist no WebAppRootListener configured. Why does
this initialisation take place anyway? The stack trace from the
exception reveals the culprit: The Log4jConfigListener also tries to
set the webAppRootKey, because this is an interesting mechanism for
the Spring/Log4j integration. It allows log and config file locations
relative to the web applications root directory. The
Log4jConfigListener supports three init parameters at the servlet
context level: 'log4jConifgLocation', 'log4jRefreshInterval' and
'log4jExposeWebAppRoot'. See JavaDocs for more informations.
But, none of these parameters are set in the riot project skeleton's
web.xml and none of the Log4jWebConfigureres features are used by the
riot project skeleton. As long as you do stay with default log4j
setup, the Log4jConfigListener is superflous.
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.
What do you think is the best solution and should be incorporated
into the riot skeleton project?
不知道各位怎么样,反正我遇到这个问题呢,主要是新item的web.xml里面多了log4j的listener,希望对遇到相同问题的童鞋有所帮助!!不喜勿喷!
分享到:
相关推荐
`java.lang.IllegalStateException: Web app root system property already set to dif` 这个异常是因为多个项目中的 `web.xml` 文件中没有配置 `webAppRootKey` 项,导致 Tomcat 无法正确地分配项目的根目录。 ...
首先,确保属性文件已经放置在webroot目录下,例如:`/webroot/config/app.properties`。这个文件应包含键值对,如`key=value`的格式。 步骤1:导入所需库 在Java代码中,我们需要使用`java.util.Properties`类来...
AppWeb是一个这样的服务器,它被设计为嵌入到各种设备和应用中,以提供网络接口和服务。在本文中,我们将深入探讨AppWeb的特性、优势...通过理解和利用其特性,你可以在资源受限的环境中创建安全、高效的Web解决方案。
Add-WindowsFeature Web-Server,Web-WebServer,Web-Common-Http,Web-Static-Content,Web-App-Dev,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Includes,Web-Security,Web-Windows-Auth,Web-...
本文旨在设计和实现基于Vue和Spring Boot的校园记录管理Web App,以解决当前校园记录管理app的高开发成本和功能不齐全的问题。该系统采用Vue和Spring Boot框架,充分利用HTML5的优点,提高了用户体验度和性能效率。...
**AppWeb嵌入式Web服务器详解** AppWeb是一款轻量级、高效的嵌入式Web服务器,专为在有限资源环境中运行而设计。...通过简单的安装和配置过程,AppWeb为Linux用户提供了一个易于管理和扩展的Web服务器解决方案。
### Office Web App Server 2013 的安装与部署 #### 前提条件 在开始安装 Office Web App Server 2013 之前,必须确保满足以下前提条件: 1. **Office Web App Server 2013 必须安装在独立的服务器上**,而不能与...
总之,AppWeb 8.2.1 提供了一个强大且灵活的嵌入式 Web 服务器解决方案,尤其适合需要高效、安全 Web 服务的嵌入式和 IoT 应用场景。通过深入理解和熟练使用,开发者可以充分利用其功能,打造高性能的网络服务。
Beginning Django Web App Dev with Python Beginning Django Web App Dev with Python
Web APP 实现类似 Nginx 反向代理转发功能 Web APP 如何实现类似 Nginx 反向代理转发功能是指在 Web 应用程序中实现反向代理转发的功能,以便将用户的请求转发到其他服务器或应用程序上。反向代理转发是一种常用的...
SystemProperty-Setting-APP Environment: Android Studio / Android 5.0 Description: This app is the system app, which need to be build in android framework or be signed. And this app is the example ...
Embedded Appweb 移植 安装 应用是指将 Appweb 服务器移植到嵌入式系统中,安装并配置 Appweb 服务器,以实现 Web 服务。Appweb 服务器是一个小巧、灵活、可扩展的 Web 服务器,支持多种功能特性,包括 Full ...
2. **主循环**:在`src/appweb.c`中,你可以找到服务器的主要事件循环,这是AppWeb运行的核心部分。 3. **配置解析**:AppWeb使用`conf.c`和`conf.h`中的函数来解析配置文件。了解这些函数的工作原理,可以方便地...
然而,通过巧妙地利用`app_process`,可以实现在不获取root权限的情况下调用shell命令,这对于一些需要进行系统级交互的应用场景非常有用。下面我们将详细探讨如何利用`app_process`来实现这一目标,以及在Java中...
### appweb嵌入式WebServer服务器学习笔记 #### 一、概述 本文档主要介绍了如何构建一个基于HTML和JavaScript的简单嵌入式WebServer服务器,特别聚焦于使用Appweb框架来实现这一目标。通过本篇笔记,我们将了解...
标题与描述概述的知识点主要围绕百度Web App开发技术,尤其是移动Web App的开发框架、平台以及与Native App的对比。接下来将对这些知识点进行详细展开。 ### 移动Web App介绍 移动Web App是一种利用HTML5、CSS3和...
Beginning Progressive Web App Development Creating a Native App Experience on the Web 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除
《AppWeb与ESP嵌入式系统源码解析与问题解决》 在嵌入式系统开发领域,AppWeb和ESP(Embedded Systems Programming)是两个至关重要的组件。AppWeb是一款轻量级、高性能的嵌入式HTTP服务器,而ESP则通常指的是在...
J2EE web app 3.1 xsd
系统程序卸载器_System App Remover_v4.13汉化版系统程序卸载器_System App Remover_v4.13汉化版