I am running Tomcat 8.5 on a windows server. I have setup a virtual host in the server.xml so that I now have domain1.com which goes to the defaultapp and domain2.com which goes to the virtual host. This works fine.
The 2 domains have different web apps but share some of the Java war modules. Is it possible to share these so that they are loaded only once and not twice for each host?
I might not have been clear: what I have is 2 web applications hosted on the different virtual hosts but they call restful APIs.
Some of those APIs are common and rather than having a war module instanced in both virtual hosts is it possible to have a common instance used by both virtual hosts?
The only thing I could think of is having all the API war modules in one virtual host and have the other virtual host web app call API there.
Does that make sense? Is there an alternative?
EDIT: To be clearer a virtual host refers to Virtual Hosting and Tomcat on this page https://tomcat.apache.org/tomcat-8.0-doc/virtual-hosting-howto.html
So the solution I have adopted is to have the 2 web apps to call a common url for all api calls.
So I will have virtualhost domain1 hosting its own angular web components and the backend server modules.
Virtualhost domain2 will hostonly its angular web components and make calls to the backend server modules using the domain1 url.
Thanks go to @mauriceperry for confirming this idea.