wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Error in web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Error in web.xml" Watch "Error in web.xml" New topic
Author

Error in web.xml

abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
I am using Tomcat 4.1.24

my web.xml is
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

</web-app>

but i am getting the following message at the console :





Apache Tomcat/4.1.24
2008/09/16 15:30:01 org.apache.commons.digester.Digester error
致命的: Parse Error at line 2 column 234: Document root element "web-app",
must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "web-app", must match
DOCTYPE root "null".
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1543)
at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:282)
at
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3567)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
2008/09/16 15:30:01 org.apache.commons.digester.Digester error
致命的: Parse Error at line 2 column 234: Document is invalid: no grammar
found.
org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(Unknown
Source)
at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1543)
at
org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:282)
at
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:639)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:243)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:166)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:3567)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:738)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1188)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at
org.apache.catalina.core.StandardService.start(StandardService.java:497)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2190)
at org.apache.catalina.startup.Catalina.start(Catalina.java:512)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
2008/09/16 15:30:04 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
2008/09/16 15:30:04 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
2008/09/16 15:30:04 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='resources.application', returnNull=true
2008/09/16 15:30:04 org.apache.struts.tiles.TilesPlugin init
情報: Tiles definition factory loaded for module ''.
2008/09/16 15:30:04 org.apache.struts.validator.ValidatorPlugIn
initResources
情報: Loading validation rules file from '/WEB-INF/validator-rules.xml'
2008/09/16 15:30:04 org.apache.struts.validator.ValidatorPlugIn
initResources
情報: Loading validation rules file from '/WEB-INF/validation.xml'
2008/09/16 15:30:06 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
2008/09/16 15:30:06 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
2008/09/16 15:30:06 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.example.AlternateApplicationResources',
returnNull=true
2008/09/16 15:30:06 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.example.ApplicationResources',
returnNull=true
2008/09/16 15:30:06
org.apache.struts.webapp.example.memory.MemoryDatabasePlugIn init
情報: Initializing memory database plug in from '/WEB-INF/database.xml'
2008/09/16 15:30:06 org.apache.struts.validator.ValidatorPlugIn
initResources
情報: Loading validation rules file from '/WEB-INF/validator-rules.xml'
2008/09/16 15:30:06 org.apache.struts.validator.ValidatorPlugIn
initResources
情報: Loading validation rules file from '/WEB-INF/validation.xml'
2008/09/16 15:30:08 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
2008/09/16 15:30:08 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
2008/09/16 15:30:08 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.exercise.ApplicationResources',
returnNull=true
2008/09/16 15:30:10 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
2008/09/16 15:30:10 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
2008/09/16 15:30:10 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.upload.UploadResources', returnNull=true
2008/09/16 15:30:11 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
2008/09/16 15:30:11 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
2008/09/16 15:30:11 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.validator.ApplicationResources',
returnNull=true
2008/09/16 15:30:11 org.apache.struts.validator.ValidatorPlugIn
initResources
情報: Loading validation rules file from '/WEB-INF/validator-rules.xml'
2008/09/16 15:30:11 org.apache.struts.validator.ValidatorPlugIn
initResources
情報: Loading validation rules file from '/WEB-INF/validation.xml'
2008/09/16 15:30:12 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.util.LocalStrings',
returnNull=true
2008/09/16 15:30:12 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing, config='org.apache.struts.action.ActionResources',
returnNull=true
2008/09/16 15:30:13 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.tiles.dev1-1.ApplicationResources',
returnNull=true
2008/09/16 15:30:13 org.apache.struts.tiles.TilesPlugin init
情報: Tiles definition factory loaded for module ''.
2008/09/16 15:30:13 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.tiles.dev1-1.ApplicationResources',
returnNull=true
2008/09/16 15:30:13 org.apache.struts.tiles.TilesPlugin init
情報: Tiles definition factory loaded for module '/tutorial'.
2008/09/16 15:30:13 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.tiles.dev1-1.ApplicationResources',
returnNull=true
2008/09/16 15:30:13 org.apache.struts.tiles.TilesPlugin init
情報: Tiles definition factory loaded for module '/test'.
2008/09/16 15:30:13 org.apache.struts.util.PropertyMessageResources <init>
情報: Initializing,
config='org.apache.struts.webapp.tiles.dev1-1.ApplicationResources',
returnNull=true
2008/09/16 15:30:13 org.apache.struts.tiles.TilesPlugin init
情報: Tiles definition factory loaded for module '/examples'.
2008/09/16 15:30:13 org.apache.coyote.http11.Http11Protocol start
情報: Coyote HTTP/1.1をポート 8080 で起動します
2008/09/16 15:30:13 org.apache.jk.common.ChannelSocket init
情報: JK2: ajp13 listening on /0.0.0.0:8009
2008/09/16 15:30:13 org.apache.jk.server.JkMain start
情報: Jk running ID=0 time=0/15 config=D:\WebDB\Tomcat\conf\jk2.properties



Can anybody tell me what to do to avoid this message.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there,

Can you post your full web.xml file? I ran your snippet against validators and it worked OK, so there might be something in the content that is causing the error.

Also perhaps check for hidden whitespace characters, especially the ^M DOS character that can cause *IX files to be misread


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
abinash das
Ranch Hand

Joined: Apr 26, 2008
Posts: 52
my web.xml is like
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

OK, I've validated that as well and it all seemed OK. Have you checked the file for hidden characters? Also make sure the web-app version="2.4" is correct/valid for that version of Tomcat.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Error in web.xml
 
Similar Threads
problem in parsing struts-config
Error while running tomcat server.
struts problem
Error while running tomcat
Page not found