理解context.xml 在tomcat6
-
12-09-2019 - |
题
我创建了一个主要空的动态网络项目在蚀。
它已
- 没有servlet
- 没有jsp文件
的web.xml 是
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>testprojekt</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>
和我加入 context.xml
它的 META-INF
文件夹
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Parameter name="companyName" value="My Company, Incorporated" override="false"/>
</Context>
我出口这个项目作为一种战争的文件。用以下结构:
user@system:$ tree
.
|-- META-INF
| |-- MANIFEST.MF
| `-- context.xml
`-- WEB-INF
|-- classes
|-- lib
`-- web.xml
4 directories, 3 files
当我将项目部署到当地的tomcat(Apache Tomcat/6.0.20)的一切工作,如预期的那样。意义,context.xml 复制到/conf/Catalina/localhost和重新命名为testprojekt.xml.
当我的编辑testprojekt.xml 为:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Parameter name="companyName" value="My BLAH Company, Incorporated" override="false"/>
</Context>
我看到下面的产出在卡塔利娜.出:
02.11.2009 13:21:35 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/testprojekt]
02.11.2009 13:21:35 org.apache.catalina.core.StandardContext resourcesStart
SCHWERWIEGEND: Error starting static Resources
java.lang.IllegalArgumentException: Document base /opt/tomcat6/webapps/testprojekt does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4048)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:630)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:556)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:491)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1274)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:296)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
at java.lang.Thread.run(Thread.java:619)
02.11.2009 13:21:35 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error in resourceStart()
02.11.2009 13:21:35 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error getConfigured
02.11.2009 13:21:35 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/testprojekt] startup failed due to previous errors
02.11.2009 13:21:35 org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/testprojekt] has not been started
为什么?是,预期的结果?什么是正确的方式改变的参数 context.xml
?
谢谢你提前。问候,
解决方案
我认为这是一个错误在Tomcat。我提出一个错误的报告,但他们要求它作为设计的。Tomcat有3种模式的部署:目录、战争和上下文中的片段。在你的情况下,它变得困惑当重新加载。
这是序列导致的错误,
- 当部署的战争,下文分段(META-INF/context.xml)是复制到conf/Catalina/[host]的目录。
- 当你修改该分段,它的正确检测到改变,因此调动触发的。
- 然而,忘记了这是一场战争的部署,把它当作目录的部署。该目录被删除,通过undelpoy所以你得到错误。
如果你只变化的XML在META-INF,一切都应该对你的工作。
其他提示
你的问题是有点暧昧但我会试一试。
删除textprojekt.xml 你编,使这些相同的变化context.xml 对于您的项目,并重新启动tomcat。
它可能是引起冲突之间的两xml文件。改变xml文件,该文件是通过创建雄猫不nto改变context.xml 文件的网络应用程序.至少它不会改变上tomcat6.0.18,我使用的开发工作。
希望这有帮助的。
不隶属于 StackOverflow