Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Porting Tomcat 6 to 7: Problem with <filter>

I tried to deploy my Tomcat 6 webapp on a Tomcat 7 server, but encounter the following problem which occurs if I add elements to my web.xml:

java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2687)
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2713)
    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:1782)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
    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:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    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:119)
    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:1543)
    at org.apache.catalina.startup.ContextConfig.parseWebXml(ContextConfig.java:1694)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1209)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:882)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:317)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5081)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:620)
    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:303)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:431)
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
    at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:802)
    at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:201)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1057)
    ... 36 more

Is there a change in the "filter notation" in Tomcat 7? I can just not get rid of the problem.

like image 752
Erik Avatar asked May 24 '11 12:05

Erik


1 Answers

I was able to solve the problem (sudden inspiration): Maven was, for whatever reason, adding a catalina-5.*.lib as dependency which is of course wrong. When removing this lib, everything works out fine.

like image 69
Erik Avatar answered Oct 13 '22 18:10

Erik