We currently have an issue where the number of deployed ear files in the container is breaching the metaspace limit. Unfortunately the servers that are used run on potatoes and can not be upgraded. The rack is full and inside a factory where there is no more floorspace. Hence, we can not simply "increase the metaspace" any longer, this was the solution for the past 5 years.
The question is similar to Would share common libraries solve my “java.lang.OutOfMemoryError: Metaspace”? but this never got an answer to the core question: Can a module containing the shared libraries actually reduce the needed metaspace? This is under the assumption that the ears themselves no longer have to load the common libraries in their ear class loader.
Currently I have made a maven project that will actually gather up all these libraries such that I can add them the ./wildfly/modules/ directory and made sure to update the jboss-deployment-structure to depend on this module. My expectation is that indeed the metaspace used should decrease, however verifying this with jstat seems to indicate that there is no improvement. In between tests I made sure to delete wildfly data directory.
Is my expectation wrong? or am I missing something?