我在tomcat7.0部署没不报错,但是再tomcat5.5就会报错。。
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"</web-app>
java.lang.reflect.InvocationTargetException
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.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:898)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:192)
at org.apache.tomcat.util.digester.Rule.end(Rule.java:228)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1057)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:351)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1041)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:260)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4143)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Caused by: java.lang.IllegalArgumentException: Filter mapping must specify either a <url-pattern> or a <servlet-name>
at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2107)
... 46 more
2014-3-6 12:12:31 org.apache.catalina.startup.ContextConfig applicationWebConfig
严重: Parse error in application web.xml file at jndi:/localhost/WEB-INF/web.xml
java.lang.IllegalArgumentException: Filter mapping must specify either a <url-pattern> or a <servlet-name>
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2725)
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2751)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1060)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2930)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1561)
at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:351)
at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1041)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:260)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4143)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:904)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:867)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
tomcat5.5不支持 Servlet2.5
你的web.xml的写法是Servlet2.5的。
注意看你的文件头部:
<web-appversion="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
在2.5版本的xsd里面:
<xsd:sequence>
<xsd:elementname="filter-name"
type="javaee:filter-nameType"/>
<xsd:choiceminOccurs="1"maxOccurs="unbounded">
<xsd:elementname="url-pattern"
type="javaee:url-patternType"/>
<xsd:elementname="servlet-name"
type="javaee:servlet-nameType"/>
</xsd:choice>
<xsd:elementname="dispatcher"
type="javaee:dispatcherType"
minOccurs="0"maxOccurs="4"/>
</xsd:sequence>
是这样的
而在2.4版本:
是这个:
<xsd:complexTypename="filter-mappingType">
<xsd:annotation>
<xsd:documentation>
Declarationofthefiltermappingsinthisweb
applicationisdonebyusingfilter-mappingType.
Thecontainerusesthefilter-mapping
declarationstodecidewhichfilterstoapplytoarequest,
andinwhatorder.ThecontainermatchestherequestURIto
aServletinthenormalway.Todeterminewhichfiltersto
applyitmatchesfilter-mappingdeclarationseitheron
servlet-name,oronurl-patternforeachfilter-mapping
element,dependingonwhichstyleisused.Theorderin
whichfiltersareinvokedistheorderinwhich
filter-mappingdeclarationsthatmatcharequestURIfora
servletappearinthelistoffilter-mappingelements.The
filter-namevaluemustbethevalueofthefilter-name
sub-elementsofoneofthefilterdeclarationsinthe
deploymentdescriptor.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:elementname="filter-name"
type="j2ee:filter-nameType"/>
<xsd:choice>
<xsd:elementname="url-pattern"
type="j2ee:url-patternType"/>
<xsd:elementname="servlet-name"
type="j2ee:servlet-nameType"/>
</xsd:choice>
<xsd:elementname="dispatcher"
type="j2ee:dispatcherType"
minOccurs="0"maxOccurs="4"/>
</xsd:sequence>
<xsd:attributename="id"type="xsd:ID"/>
</xsd:complexType>
eithera<url-pattern>ora<servlet-name>
就是要么用 <url-pattern> ,要么 <servlet-name>,不能两个都放里面。
应该是adminFilter这个
eithera<url-pattern>ora<servlet-name>
就是要么用 <url-pattern> ,要么 <servlet-name>,不能两个都放里面。
应该是adminFilter这个
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。