Cannot is cast to Javax.servletfilter

Source: Internet
Author: User

Java.lang.ClassCastException:org.springframework.web.filter.CharacterEncodingFilter cannot is cast to Javax.servlet.Filter at Org.apache.catalina.core.ApplicationFilterConfig.getFilter (Applicationfilterconfig.java : 275) Cause: May be a package conflict one of your dependencies is including a SERVLET-API into your war file which causes that behavior. Using mvn Dependency:tree, you can find out which of your dependency are that. Need to exclude the SERVLET-API as Follows:<dependency> workaround:
<Dependency><Groupid>[value]</Groupid><Artifactid>[value]</artifactid> < version>[value]</version> Span class= "Hljs-tag" ><exclusions> < exclusion> <groupId> Javax.servlet</groupid> <artifactid>servlet-api</artifactId > </exclusion> </exclusions></DEPENDENCY>    
Example:
<!--Remove your own servlet dependencies to avoid conflicts--<Dependency><Groupid>javax.servlet</Groupid><Artifactid>javax.servlet-api</Artifactid><version>3.1.0</version> < scope>provided</scope> <exclusions> < exclusion> <groupId> Javax.servlet</groupid> <artifactid>servlet-api</artifactId > </exclusion> </exclusions> </DEPENDENCY>    

Cannot is cast to Javax.servletfilter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.