Deploying webapp with multiple instances
I have a webapp that defines jmx name using annotations, example
@ManagedResource(objectName="bean:name=threadPool" ,description="A pool of threads")
I start the webapp and jconsole and I can successfully view my jmx bean yeah!
I then deploy the webapp's ear again under a new name and path, example
first: /myapp
second: /yourapp
both myapp and yourapp are either the exact same webapp code (or one is using newer code ie one is last weeks and one is this weeks code) and both are pointing to separate databases.
When the myapp comes up, no problem the jmx bean comes up and is seen by jconsole as expected
But when yourapp comes up it dies because myapp is already using the desired name:
javax.management.InstanceAlreadyExistsException: bean:name=threadPool
What I would like is to have each webapps come up and have both sets of threadpool jmx beans available from jconsole.
What is the spring recommended way to handling this?