aspose file tools*
The moose likes Servlets and the fly likes any clue about 'web.xml' ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "any clue about Watch "any clue about New topic
Author

any clue about 'web.xml' ?

Advait Chitalia
Greenhorn

Joined: Mar 24, 2001
Posts: 13
i am getting the following error in startup.bat window(i have windows NT)-- please help me:
**********************
ERROR reading C:\tomcat\webapps\test\WEB-INF\web.xml
At Document root element is missing.
ERROR reading C:\tomcat\webapps\test\WEB-INF\web.xml
org.xml.sax.SAXParseException: Document root element is missing.
at com.sun.xml.parser.Parser.fatal(Parser.java:2817)
at com.sun.xml.parser.Parser.fatal(Parser.java:2805)
at com.sun.xml.parser.Parser.parseInternal(Parser.java:493)
at com.sun.xml.parser.Parser.parse(Parser.java:284)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:155)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:126)
at org.apache.tomcat.util.xml.XmlMapper.readXml(XmlMapper.java:214)
at org.apache.tomcat.context.WebXmlReader.processWebXmlFile(WebXmlReader
.java:202)
at org.apache.tomcat.context.WebXmlReader.contextInit(WebXmlReader.java:
109)
at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java
, Compiled Code)
at org.apache.tomcat.core.ContextManager.init(ContextManager.java, Compi
led Code)
at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195)
at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
2001-05-17 02:31:31 - PoolTcpConnector: Starting HttpConnectionHandler on 8080
2001-05-17 02:31:31 - PoolTcpConnector: Starting Ajp12ConnectionHandler on 8007
**********************
-advait chitalia.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
It looks like you have a strangely formatted web.xml file. web.xml is the definition file for what is contained in a web application and how it all fits together. Please show us your web.xml file, and we'll try to spot what's wrong with it.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Advait Chitalia
Greenhorn

Joined: Mar 24, 2001
Posts: 13
Hi Frank,
I am actually not able to open the web.xml file. when I try to open it through an editor like Edit Plus, it shows me squares and notext. By the way, i am able to see the contents of the web.xml file located under C:\tomcat\conf\web.xml where c:\tomcat is my TOMCAT_HOME
following is the file content of web.xml located under ..\conf\
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
default
</servlet-name>
<servlet-class>
org.apache.tomcat.servlets.DefaultServlet
</servlet-class>
<load-on-startup>
-2147483646
</load-on-startup>
........
........
........
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
<welcome-file>
index.html
</welcome-file>
<welcome-file>
index.htm
</welcome-file>
</welcome-file-list>
</web-app>
*************************
thanx,
advait chitalia
[This message has been edited by Advait Chitalia (edited May 17, 2001).]
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Well if you can't open and read the web.xml file it's complaining about, that's why it is complaining! web.xml should be a readable text file, formatted as xml.
Do you know how it became overwritten with a non-text file? Did you edit it with something non-text like Microsoft Word?
Advait Chitalia
Greenhorn

Joined: Mar 24, 2001
Posts: 13
dear Frank,
thanx for your prompt reply at this time of the night there!
i don't know how it happened, but i tried to copy tomcat from a CD . It didn't work. finally, i downloaded the tomcat3.2.1 from the net. Should I copy the web.xml file from the conf directory and paste to the test\WEB-INF directory?
thanx,
-advait.
Advait Chitalia
Greenhorn

Joined: Mar 24, 2001
Posts: 13
the web.xml file residing under the test\web-inf folder is not readable whereas the web.xml file residing under root\conf folder is readable. Why is it so?
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
For a web.xml to not be readable is a mistake of some sort. Try replacing it with this very simple one and see what happens:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: any clue about 'web.xml' ?