This can also happen if you compiled a jar, which includes its runtime dependencies, and references an old version of tomcat servlet-api.jar.
Then, when your flask is loaded into another version of Tomcat, the servlet api is incorrect, and this causes this error.
So, check how your jar is compiled, and make sure that it does not include the servlet-api.jar as a dependency in any way!
source share