The namespace for Java EE Servlets was changed some time ago from javax.servlet to jakarta.servlet. Although there are probably plenty of applications still working with the old namespace, Tomcat has changed over to the jakarta namespace starting with Tomcat V10. This change means that Jython's PyServlet won't work with webapps that want to run under Tomcat 10+. The Pyfilter class is also affected.
Tomcat supplies a utility that can change the javax.servlet namespace to jakarta.servlet inside an existing jar file. This worked for me on the Jython standalone jar file.
Obviously it would be easy to edit the source of PyServlet and PyFilter and to add a newer version of the servelt-api jar to the extlibs directory, but how to maintain two versions, one for each of the servlet namespaces, isn't so easy to know.
I don't have a recommendation on the best way to do this but the matter should be addressed.