论坛首页 入门技术论坛

web.xml的配置问题

浏览 3577 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-12-16  

web.xml的问题:报错如下

org.apache.commons.digester.Digester error
严重: Parse Error at line 137 column 11: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must match "(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
    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.handleEndElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(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.XML11Configuration.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:1548)
    at org.apache.catalina.startup.ContextConfig.applicationConfig(ContextConfig.java:220)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:579)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:181)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3523)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:774)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:760)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:548)
    at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:260)
    at org.apache.catalina.core.StandardHost.install(StandardHost.java:741)
    at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:512)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:354)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:671)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1149)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:707)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1141)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:316)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:2143)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:463)
    at org.apache.catalina.startup.Catalina.execute(Catalina.java:350)
    at org.apache.catalina.startup.Catalina.process(Catalina.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:156)

 

 

后来查了下,是因为这个原因:

XML   对大小写是很敏感的,对顺序虽然不敏感但它可以对错序的情况报错。  
  <servlet>一定要在所有的<servlet-mapping>前面,不然就会报如上错误,改变位置后问题解决

   发表时间:2008-12-16  
如果你使用ide工具的话应该会提醒你的吧
0 请登录后投票
   发表时间:2008-12-16  
myeclipse也没提醒我--;
0 请登录后投票
   发表时间:2008-12-16  
请注意在一些中间件中 web.xml里面节点的顺序。按照规范写这些顺序应该就可以了。。。。
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics