tomcat 下多个应用时报错

上周做系统上线时,在tomcat的webapps目录下又添加了一个项目mds.war,war正常部署后,通过浏览器不能正常访问,查看tomcat的log,发现如下报错信息:

16-Apr-2015 08:58:25.937 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart 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‘ = [/data/tomcat/webapps/bocode] instead of [/data/tomcat/webapps/httpjson] - Choose unique values for the ‘webAppRootKey‘

context-param in your web.xml files!

at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:144)

at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117)

at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)

at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4750)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5170)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:724)

at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:700)

at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)

at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:919)

at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1704)

at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

分析上述报错信息:Web app root system property already set to different value

web.xml中webAppRootKey

------------------------------------------------------------------------------------------------

1、 web.xml配置

<context-param>

<param-name>webAppRootKey</param-name>

<param-value>webapp.root</param-value>

</context-param>

"webapp.root"这个字符串可以随便写任何字符串。如果不配置默认值是"webapp.root"。

可以用System.getProperty("webapp.root")来动态获项目的运行路径。

一般返回结果例如:/datatomcat/webapps/项目名

2、解决以下报错

部署在同一容器中的Web项目,要配置不同的<param-value>,不能重复,否则报类似下面的错误:

Web app root system property already set to different value: Web app root system property already set to different value: ‘webapp.root‘ = [/data/tomcat/webapps/bocode] instead of [/data/tomcat/webapps/httpjson] - Choose unique values

for the ‘webAppRootKey‘ context-param in your web.xml files!

意思是“webapp.root”这个key已经指向了项目1,不可以再指向项目2.

解决方法如下:

### app1:

<context-param>

<param-name>webAppRootKey</param-name>

<param-value>app1.root</param-value>

</context-param>

### app2:

<context-param>

<param-name>webAppRootKey</param-name>

<param-value>app2.roo

参考文章: http://elf8848.iteye.com/blog/2008595

http://yzxqml.iteye.com/blog/1761540

http://www.thinksaas.cn/group/topic/328055/

时间: 2024-11-08 07:54:52

tomcat 下多个应用时报错的相关文章

2个问题,解决tomcat启动一闪而过和运行tomcat/bin目录下的startup.bat时报错(the CATALINA_HOME environment variable is not defined correctly)

1.除手动使用开始菜单自启动或者程序启动TOMCAT时TOMCAT一闪而过,这时候是发生了错误,这时候我们打开BIN目录下的“startup.bat”文件,编辑,在结尾添加pause命名,这样在CMD下执行startup.bat时就会出错停止,这时候我们就知道是什么错误了. 2.运行tomcat/bin目录下的startup.bat时报错:the CATALINA_HOME environment variable is not defined correctly 碰到这个问题时的第一反应是添加

CentOS下编译CPP文件时报错[undefined reference to `__gxx_personality_v0&#39; collect2: ld]的解决办法

在CentOS环境下编译CPP时报出 undefined reference to `__gxx_personality_v0' collect2: ld 以上错误,调查了一下,加上参数[-lstdc++]就可解决 例: gcc -lstdc++ a.cpp 参考自http://mlq.blog78.fc2.com/?mode=m&no=14 CentOS下编译CPP文件时报错[undefined reference to `__gxx_personality_v0' collect2: ld]

win10下pip3安装tesserocr时报错

使用pip3在线安装tesserocr时报错,刚开始报错内容是提示未安装vs2014,安装完以后报错内容如下 ERROR: Command errored out with exit status 1: command: 'c:\users\administrator\appdata\local\programs\python\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"

使用myeclipse tomcat插件部署web项目时报错 an internal error occurred during add deployment . java.lang.nullpointerexception

问题描述: 使用myeclipse10的tomcat插件部署web项目时,首次部署.实际部署到了tomcat/webapps目录下且tomcat启动成功,但是eclipse报错"An internal error occurred during: "Add Deployment"  : 且eclipse中看不到部署的项目.重新部署按钮也无法点击,如图: myeclipse中看不到部署的项目: myeclipse中可以看到部署的项目如下(作为看不到项目的对比): 再次试图部署项

tomcat链接mysql时超时报错java.io.EOFException: Can not read response from server. Expected to read 4 bytes,

需要在配置文件里加上下面就ok了 <property name=”minEvictableIdleTimeMillis” value=”1800000″ /> <property name=”numTestsPerEvictionRun” value=”3″ /> <property name=”testOnBorrow” value=”true” /> <property name=”testWhileIdle” value=”true” /> <p

idea中tomcat启动时报错

之前的项目是用MyEclipse 10 写的项目,之后转移到idea上去,各种配置都弄好后,部署好tomcat启动项目时报错: java.lang.UnsatisfiedLinkError: Can't load AMD 64-bit .dll on a IA 32-bit' platform   从错误信息中大致可以知道是跟计算机的32位和64位相关的问题,后面查阅资料之后知道是jdk和tomcat冲突了,应该是一个是32位一个是64位所以会显示这个错误 可是在cmd中输入java -vers

tomcat部属项目时报错:An internal error occurred during Add Deployment.java.lang.NullPointerException

在tomcat上部部署时报错: An internal error occurred during Add Deployment. java.lang.NullPointerException 查了一下说出现这种错误一般是是因为down的项目与本机的JDK版本不一致所致. 查了一下发现导入的类库报错,删除后重新选择jdk就好了 右键项目名→Properties→Java Build Path→Libraries→选中JRE System Library[Sun JDK 1.5.0.22]→Edi

在tomcat7下停止应用时报错:created a ThreadLocal with key of type

在tomcat7下停止应用时报错: created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance. Apr 02, 2015 10:36:52 AM org.apache.coyote.Abs

tomcat下部署了多个项目启动报错java web error:Choose unique values for the &#39;webAppRootKey&#39; context-param in your web.xml files

应该是tomcat下部署了多个项目且都使用log4j. <!--如果不定义webAppRootKey参数,那么webAppRootKey就是缺省的"webapp.root".但最好设置,以免项目之间的名称冲突. 定义以后,在Web Container启动时将把ROOT的绝对路径写到系统变量里. 然后log4j的配置文件里就可以用${webName.root }来表示Web目录的绝对路径,把log文件存放于webapp中. 此参数用于后面的“Log4jConfigListener”