0

I was trying to mitigate the spring4shell vulnerability in one of our Spring Applications. Currently we are on Tomcat 7 and open JDK11. I am working on updating tomcat to 10.0.20 and when I try to deploy the application I see the below error.

org.apache.catalina.core.StandardContext.listenetStart Error configuring application listener of class [org.jboss.resteasy.plugins.spring.SpringContextLoaderListener] java.lang.NoClassDefFoundError: /javax/servlet/ServletContextListener

I am using Spring 4.3.5.RELEASE my question is which version of tomcat to use with open JDK 11?

Thanks in advance. pbale

pbale
  • 1
  • 2

1 Answers1

0

Spring 5 does not work with Tomcat 10 due to package changes and renaming them from javax to jakarta in the Tomcat libraries. Neither does Spring 4. The first Spring that will work with Tomcat 10, will be Spring 6. Tomcat 8 or 9 should work just fine, try with 9 first. I know that Tomcat 8 works great with Spring 4, I used it quite often, but when 5 got out I moved to Tomcat 9.

zawarudo
  • 1,907
  • 2
  • 10
  • 20
  • thank you for clarifying. I tried upgrading to tomcat 9 and now I don't see any errors but my application isn't starting. It's saying that "The server is temporarily unable to service your request due to maintenance downtime or capacity problems." When I check the localhost logs, it says 'No Spring WebApplicationInitializer detected on classpath." It doesn't seem to be an error but I am not able to figure out what went wrong. I tried with tomcat8.5.78 as well. I see the same issue. – pbale Apr 25 '22 at 20:59
  • stay with tomcat 9 and drop in log4j to get more details, your current issue is not related to tomcat atm – zawarudo Apr 25 '22 at 21:34
  • Thank you. I think the issue is I was using the 'org.apache.coyote.ajp.AjpProtocol' which is deprecated in tomcat9. I replaced it with org.apache.coyote.ajp.AjpNioProtocol and as well I had to match the packetsize in server.xml to the modjk file. – pbale May 10 '22 at 19:57