bug Report about a tomcat issue

the problem was a Tomcat 404 page.
type Status report
message /mywar/default
description The requested resource (/mywar/default) is not available.
The file mywar.war was plainly in  $TOMCAT_HOME/webapps/, and the Host was configued with  unpackWARs="true" and  autoDeploy="true" so Tomcat should recognize a new or changed war file and deploy it within just a few seconds. Flailing about, I changed the war file name to mywar2.war, and Tomcat deployed it without delay. When I changed the name back to mywar.war, the mywar2 context was undeployed, but it just ignored mywar.war, so there had to be something specific to the war file name. Next I tried stopping and starting Tomcat. This had worked in a similar situation a few weeks back.
bin/shutdown.sh && tail -f logs/catalina.out #wait until shutdown is completed
bin/startup.sh && tail -f logs/catalina.out
My first real clue was finding this in the shutdown output:
Sep 25, 2009 12:57:49 PM org.apache.catalina.startup.HostConfig.undeployApps
WARNING: Error while removing context [/mywar]
java.lang.NullPointerException
        at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:915)
        at org.apache.catalina.startup.HostConfig.undeployApps(HostConfig.java:1248)
        at org.apache.catalina.startup.HostConfig.stop(HostConfig.java:1219)
        <snip>
which seems to imply that Tomcat though the war was already deployed. Then on startup:
INFO: Deploying web application archive mywar.war
Sep 25, 2009 12:58:41 PM org.apache.tomcat.util.digester.Digester
fatalError
SEVERE: Parse Fatal Error at line 1 column 1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174)
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388)
        at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1414)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1059)
        <snip>
This clearly shows that Tomcat was attempting to deploy the webapp, but it failed to parse some XML file. When I tried  touching the war file, Tomcat still ignored it; no error in the log this time. I vaguely remembered that Tomcat creates a file for (some?) webapps somewhere in  $TOMCAT_HOME/conf/, so I used one of my favorite *nix tools,  find.
find conf -name "*mywar*"
conf/Catalina/localhost/mywar.xml
The file simply contained:
<xml version="1.0">
<Context path="" />
I deleted the file, stopped and restarted Tomcat again, and blammo - webapp deployed. My guess is that the app hadn't been undeployed properly at some point, causing Tomcat to keep the context file around without the exploded war content.
In my subsequent research, I found that this file can be used to register a webapp with Tomcat without the need to create a war file. If I have a webapp in /home/mpartridge/workspace/MyProject/web, I can create the file $TOMCAT_HOME/conf/Catalina/localhost/MyProject.xml:
<xml version="1.0">
<Context path="/mywar"
 docBase="/home/mpartridge/workspace/MyProject/web"
 reloadable="true" />

and Tomcat will serve the webapp. Then whenever I make a change, Tomcat will automatically reload the context.


FROM: http://www.hierax.org/2009/09/tomcat6-fails-to-deploy-war-file.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值