What you are describing is not entirely compatible with Servlets logic.
If you want to use a service / library from two different applications in Tomcat, you can add the library as a shared library in Tomcat. You can then use this library from your application servlets. If you want to achieve this, you need to add the jar to $CATALINA_HOME/shared/lib , and then edit $CATALINA_HOME/conf/catalina.properties to add the {catalina.home}/mylibs/*.jar common.loader to common.loader . You can then use your library in various servlets of your applications.
However, this is different from what you are describing. In fact, what you are describing is not possible in Tomcat, since each web application has its own ApplicationContext. So the webappA application context will be http: // host / webappA and the webappB application context will be http: // host / webappB . So, if you want to have a servlet outside of these two applications, this servlet will belong to another ApplicationContext. Thus, it will not be possible to access this servlet through any of the paths http: // host / webappA / common , http: // host / webappB / common , which are related to previous ApplicationContexts.
Dimos source share