Home > Back-end >  java.lang.NoClassDefFoundError: javax/servlet/Filter : How to use sitemesh 2.4 with spring 6
java.lang.NoClassDefFoundError: javax/servlet/Filter : How to use sitemesh 2.4 with spring 6

Time:01-26

Recently, I have upgraded my application library to use spring 6, tomcat 10. But some of the library still using the old ones like sitemesh.

When running application, i got error the java.lang.NoClassDefFoundError: javax/servlet/Filter.

Since tomcat 10 and spring 6 using jakarta instead of javax, sitemesh library was not able to find the needed class.

How to workaround this when I also using servlet-api 6 for ContextListener?

I have checked the sitemesh jar file, the latest being 2.4.2 which the version I'm currently using.

CodePudding user response:

You don't. Spring 6 / Tomcat 10 is a breaking upgrade. Any library that was built for Spring 5 / Tomcat 9 and referencing the servlet apis isn't compatible and you need to wait for Sitemesh to upgrade. There are plenty of 3rd party libs that are no longer compatible, so you aren't alone.

  • Related