使用gradle构建的项目,里面加了 一些依赖,这些依赖会自动下载tomcat的jar,但是这些jar和我部署使用的Tomcat版本是不一样的,导致了这个问题,错误如下:
Tomacat7启动报错如下:
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:855)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1051)
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)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)atcom.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)atcom.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)atcom.sun.org.apache.xerces.internal.jaxp.SAXParserImpl JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)
at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1825)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1201)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase StartChild.call(ContainerBase.java:1566)atorg.apache.catalina.core.ContainerBase StartChild.call(ContainerBase.java:1556)
at java.util.concurrent.FutureTask Sync.innerRun(FutureTask.java:303)atjava.util.concurrent.FutureTask.run(FutureTask.java:138)atjava.util.concurrent.ThreadPoolExecutor Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor Worker.run(ThreadPoolExecutor.java:908)atjava.lang.Thread.run(Thread.java:619)2012−11−1512:31:37org.apache.catalina.startup.ContextConfigparseWebXml严重:Parseerrorinapplicationweb.xmlfileatjndi:/localhost/ssy/WEB−INF/web.xmljava.lang.NoSuchMethodException:org.apache.catalina.deploy.WebXmladdFilteratorg.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2687)atorg.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2719)atorg.apache.tomcat.util.digester.Digester.endElement(Digester.java:1054)atcom.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1774)atcom.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)atorg.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)atorg.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1825)atorg.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1201)atorg.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:855)atorg.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:345)atorg.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)atorg.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)atorg.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5161)atorg.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)atorg.apache.catalina.core.ContainerBase StartChild.call(ContainerBase.java:1566)
at org.apache.catalina.core.ContainerBase StartChild.call(ContainerBase.java:1556)atjava.util.concurrent.FutureTask Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor Worker.runTask(ThreadPoolExecutor.java:886)atjava.util.concurrent.ThreadPoolExecutor Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:855)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1051)
… 26 more
把这两个依赖去掉就行