Does Tomcat load the same library file into memory twice if they are in two web apps?

As you can see here, Tomcat creates one class-loader per webapp on your server.
Thus, if you have webapp1 and webapp2 that share the same library, then this library will be indeed loaded twice.

You can eventually place this library in the common directory (tomcat-dir/common/lib) if it is shared by all webapps that run on your Tomcat server.

Leave a Comment