I have two applications under tomcat/webapps
folder.
tomcat/webapps/App1
tomcat/webapps/App2
Both applications share the same libraries. Which are stored for example in tomcat/webapps/App1/WEB-INF/lib
.
Are both libraries loaded twice in memory?
Should I put these shared libraries in tomcat/server/lib
?
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.