Tomcat Deployed Applications Start Error: java.lang.ClassCastException: [XXX].filter.CharacterEncoding cannot be cast to jakarta.servlet.Filter

When xiaomengxin was learning to deploy applications on the Java Web, he found that the console could not normally connect to the MySQL database, but it was always normal when using the idea test. Looking at the Tomcat startup log, he found that there was an error message. Through comparison, he found that tomcat9 was configured in the idea and tomcat10 was installed on the server, Baidu knows that the servlet package of tomcat10 and later has changed and needs to be imported into Jakarta servlet.* Replace javax.XML with a new package servlet.* Or directly replace it with tomcat9 version to avoid this error.

Error screenshot:

Similar Posts: