Oct 13th, 2007, 07:53 PM
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
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:
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?
Oct 14th, 2007, 02:44 PM
To provide more control over MBean naming, you can plug a different implementation of ObjectNamingStrategy into your MBeanExporter:
Out of the box, Spring provides an IdentityNamingStrategy implementation which might help to avoid the sort of naming conflicts you describe, but if you want to have more meaningful names, you can implement your own. See the following thread for more discussion on this topic, and an example of a custom ObjectNamingStrategy which includes the servlet context name in the MBean object name:
Oct 15th, 2007, 05:44 PM
Thanks that was just what I was looking for