java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet

信息: validateJarFile(E:\soft\apache-tomcat-7.0.40\wtpwebapps\hfwy\WEB-INF\lib\tomcat-servlet-api-7.0.0.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

九月 21, 2017 1:58:16 下午 org.apache.tomcat.util.digester.Digester endElement

严重: End event threw exception

java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet

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:609)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)

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:848)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)

at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)

at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1899)

at org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment(ContextConfig.java:1469)

at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1246)

at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)

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:5322)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)

 

九月 21, 2017 1:58:16 下午 org.apache.catalina.startup.ContextConfig parseWebXml

严重: Parse error in application web.xml file at file:/E:/soft/apache-tomcat-7.0.40/conf/web.xml

org.xml.sax.SAXParseException; systemId: file:/E:/soft/apache-tomcat-7.0.40/conf/web.xml; lineNumber: 103; columnNumber: 15; Error at (103, 15) : org.apache.catalina.deploy.WebXml addServlet

at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2687)

at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2719)

at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1054)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2973)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)

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:848)

at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)

at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)

at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:648)

at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1537)

at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1899)

at org.apache.catalina.startup.ContextConfig.getDefaultWebXmlFragment(ContextConfig.java:1469)

at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1246)

at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)

at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)

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:5322)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)

at java.util.concurrent.FutureTask.run(FutureTask.java:262)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet

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

 

 

        eclipse启动项目时报这个错,引起这个异常的原因是我引入了两个jar包到这个项目中 catalina.jar,tomcat-coyote.jar。这个是tomcat提供的两个jar包。当在tomcat中部署这个项目的时候会出现这个异常,应该是包冲突的原因。我从网上搜了很多的解决办法,主要有一下三种。

1、删除您添加在Referenced Libraries 下的catalina.jar包,然后删除Webapp下的部署程序,重新部署。

2、在tomacat的context.xml里加上

3、修改包的部署配置 、右键project-> Properties-> myeclipse-> web -> deployment 修改 Lib...Policies  取消 default   取消 jars from build path

你可能感兴趣的:(java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addServlet)