0

I have servlet-api.jar in tomcat/lib folder and WEB-INF/lib/servlet-api 3.1.0 jar (i.e application dependent). I would like to know how to find which version of jar is currently in use when tomcat is running. https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html from here, i see order of class loading is as follows

Bootstrap classes of your JVM
/WEB-INF/classes of your web application
/WEB-INF/lib/*.jar of your web application
System class loader classes (described above)
Common class loader classes (described above)

but how to know if common class loader overrides the above jar present in WEB-INF/lib folder. can someone please answer.

vrreddy1234
  • 343
  • 5
  • 16
  • 2
    This is answered on the page linked in the question: “the web application class loader will always delegate first for JavaEE API classes for the specifications implemented by Tomcat (Servlet, JSP, EL, WebSocket)” – Tim Moore Jul 17 '23 at 07:37
  • And since that sentence can be hard to parse: Yes, that means it'll use the jar from `tomcat/lib` before anything from `WEB-INF` – Jorn Jul 17 '23 at 07:42
  • if i want to test if tomcat/lib servlet-api.jar is jar picked at runtime, can you please suggest how to test it. thanks – vrreddy1234 Jul 17 '23 at 08:24
  • Two suggestions: set verbose classloading on the container. Examine file handles with tools appropriate for your OS – g00se Jul 17 '23 at 09:02

0 Answers0