-
Dec 13th, 2012, 06:36 PM
#1
NoSuchMethodException is thrown when deploying spring app into tomcat
Hi,
When I try to deploy the sample application(springblog) from "Pro Spring3" book into tomcat, I always got a java.lang.NoSuchMethodException which indicates that it failed to parse the DelegatingFilterProxy in web.xml. I am sure that all the corresponding spring jars are there. But I don't know why it still fails. Could anyone give some tips ?
Thanks in advance!
1. This is the content of web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<!-- Enable escaping of form submission contents -->
<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>spring.profiles.active</param-name>
<!-- Spring profile parameters
First profile: jpa - JPA implementation
mybatis - MyBatis implementation
Second profile: mysql - MySQL DB
h2 - H2 database
-->
<param-value>jpa,h2</param-value>
</context-param>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/root-context.xml
/WEB-INF/spring/datasource.xml
/WEB-INF/spring/batch-context.xml
/WEB-INF/spring/*-tx-config.xml
/WEB-INF/spring/*-service-context.xml
</param-value>
</context-param>
<!-- Spring Security Configuration -->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFil terProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
...
</web-app>
2. This is the error output of tomcat when it starts:
WARNING: [SetPropertiesRule]{Context/Loader} Setting property 'useSystemClassLoaderAsParent' to 'false' did not find a matching property.
Dec 14, 2012 8:20:19 AM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
at org.apache.tomcat.util.IntrospectionUtils.callMeth od1(IntrospectionUtils.java:855)
at org.apache.tomcat.util.digester.SetNextRule.end(Se tNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElemen t(Digester.java:1051)
at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.endElement(AbstractSAXParser.java:606)
...
at java.lang.Thread.run(Thread.java:722)
Dec 14, 2012 8:20:19 AM org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Parse error in application web.xml file at jndi:/localhost/springblog/WEB-INF/web.xml
org.xml.sax.SAXParseException; systemId: jndi:/localhost/springblog/WEB-INF/web.xml; lineNumber: 34; columnNumber: 14; Error at (34, 14) : org.apache.catalina.deploy.WebXml addFilter
at org.apache.tomcat.util.digester.Digester.createSAX Exception(Digester.java:2687)
...
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
at org.apache.tomcat.util.IntrospectionUtils.callMeth od1(IntrospectionUtils.java:855)
at org.apache.tomcat.util.digester.SetNextRule.end(Se tNextRule.java:201)
at org.apache.tomcat.util.digester.Digester.endElemen t(Digester.java:1051)
... 30 more
Dec 14, 2012 8:20:19 AM org.apache.catalina.startup.ContextConfig parseWebXml
SEVERE: Occurred at line 34 column 14
Dec 14, 2012 8:20:19 AM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
Dec 14, 2012 8:20:19 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
Dec 14, 2012 8:20:19 AM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/springblog] startup failed due to previous errors
Last edited by rc_hz; Dec 13th, 2012 at 06:43 PM.
-
Apr 11th, 2013, 12:23 PM
#2
Actually our project experienced this kind of error, it made our sonar post job task failing.
And we actually discovered this error due to a SEVERE error when Tomcat was trying to do some stuff in the JNDI, which resulted in the JNDI datasource to not be added to the context which resulted in failure to inject some dependencies.
SEVERE: Creation of the naming context failed: javax.naming.OperationNotSupportedException: Context is read only.
And we got away with the error with a recent build of the tomcat7 maven plugin (for us it was version 2.1). And it will load the tomcat-embed-core 7.0.37 which seems to have fixed this issue (before that we had tomcat-embed-core 7.0.32).
Not sure what was wrong though while reading the changelog : http://tomcat.apache.org/tomcat-7.0-doc/changelog.html
HTH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules