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?
分享到:
相关推荐
MAC 下 Web App to native app 的框架.zip,将Web应用程序捆绑到本机OS X应用程序
Appweb是一个嵌入式HTTP Web服务器,主要的设计思路是安全。这是直接集成到客户的应用和设备,便于开发和部署基于Web的应用程序和设备。它迅速( 每秒处理3500多要求)而紧凑 ,其中包括支持动态网页制作,服务器端...
介绍Web App 和Native App的相同和不同之处,并阐释了他们相互之间的关系、优缺点,对Web App 和Native App了解必读
Beginning Django Web App Dev with Python Beginning Django Web App Dev with Python
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 ...
appweb 嵌入式的web服务器 ,占用的内存空间只有800kb。
Beginning Progressive Web App Development Creating a Native App Experience on the Web 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除
J2EE web app 3.1 xsd
Office Web App Server 2013 Installation guide
Pro MERN Stack Full Stack Web App Development with Mongo Express React and Node.pdf Pro MERN Stack Full Stack Web App Development with Mongo Express React and Node.pdf Pro MERN Stack Full Stack Web ...
Azure Web App开发者参考手册 Azure web apps for developers
开放时代从Web_Page到Web_App
Office web app server2013 安装与部署
OWASP Hacking Tutorials and Web App Protection,推荐一看。
appweb4.3.4-0添加arm配置及源代码,有相关说明文件
Web App 开发超入门资料
Appweb开Appweb开发指南发指南Appweb开发指南Appweb开发指南Appweb开发指南
Web APP技术框架下“大学校园助手”APP的设计与实现.pdf
学生上课签到系统源码+项目说明(手机web app).zip学生上课签到系统源码+项目说明(手机web app).zip学生上课签到系统源码+项目说明(手机web app).zip学生上课签到系统源码+项目说明(手机web app).zip学生上课签到系统...
修改源码让APP获取root权限可以执行su命令的git diff记录